##// END OF EJS Templates
cmdutil, logmessage: use ui.fin when reading from '-'
Idan Kamara -
r14635:217b7d83 default
parent child Browse files
Show More
@@ -122,7 +122,7 def fetch(ui, repo, source='default', **
122
122
123 if not err:
123 if not err:
124 # we don't translate commit messages
124 # we don't translate commit messages
125 message = (cmdutil.logmessage(opts) or
125 message = (cmdutil.logmessage(ui, opts) or
126 ('Automated merge with %s' %
126 ('Automated merge with %s' %
127 util.removeauth(other.url())))
127 util.removeauth(other.url())))
128 editor = cmdutil.commiteditor
128 editor = cmdutil.commiteditor
@@ -2211,7 +2211,7 def new(ui, repo, patch, *args, **opts):
2211
2211
2212 Returns 0 on successful creation of a new patch.
2212 Returns 0 on successful creation of a new patch.
2213 """
2213 """
2214 msg = cmdutil.logmessage(opts)
2214 msg = cmdutil.logmessage(ui, opts)
2215 def getmsg():
2215 def getmsg():
2216 return ui.edit(msg, opts.get('user') or ui.username())
2216 return ui.edit(msg, opts.get('user') or ui.username())
2217 q = repo.mq
2217 q = repo.mq
@@ -2262,7 +2262,7 def refresh(ui, repo, *pats, **opts):
2262 Returns 0 on success.
2262 Returns 0 on success.
2263 """
2263 """
2264 q = repo.mq
2264 q = repo.mq
2265 message = cmdutil.logmessage(opts)
2265 message = cmdutil.logmessage(ui, opts)
2266 if opts.get('edit'):
2266 if opts.get('edit'):
2267 if not q.applied:
2267 if not q.applied:
2268 ui.write(_("no patches applied\n"))
2268 ui.write(_("no patches applied\n"))
@@ -2332,7 +2332,7 def fold(ui, repo, *files, **opts):
2332 raise util.Abort(_('no patches applied'))
2332 raise util.Abort(_('no patches applied'))
2333 q.checklocalchanges(repo)
2333 q.checklocalchanges(repo)
2334
2334
2335 message = cmdutil.logmessage(opts)
2335 message = cmdutil.logmessage(ui, opts)
2336 if opts.get('edit'):
2336 if opts.get('edit'):
2337 if message:
2337 if message:
2338 raise util.Abort(_('option "-e" incompatible with "-m" or "-l"'))
2338 raise util.Abort(_('option "-e" incompatible with "-m" or "-l"'))
@@ -2661,7 +2661,7 def save(ui, repo, **opts):
2661
2661
2662 This command is deprecated, use :hg:`rebase` instead."""
2662 This command is deprecated, use :hg:`rebase` instead."""
2663 q = repo.mq
2663 q = repo.mq
2664 message = cmdutil.logmessage(opts)
2664 message = cmdutil.logmessage(ui, opts)
2665 ret = q.save(repo, msg=message)
2665 ret = q.save(repo, msg=message)
2666 if ret:
2666 if ret:
2667 return ret
2667 return ret
@@ -117,7 +117,7 def rebase(ui, repo, **opts):
117 contf = opts.get('continue')
117 contf = opts.get('continue')
118 abortf = opts.get('abort')
118 abortf = opts.get('abort')
119 collapsef = opts.get('collapse', False)
119 collapsef = opts.get('collapse', False)
120 collapsemsg = cmdutil.logmessage(opts)
120 collapsemsg = cmdutil.logmessage(ui, opts)
121 extrafn = opts.get('extrafn') # internal, used by e.g. hgsubversion
121 extrafn = opts.get('extrafn') # internal, used by e.g. hgsubversion
122 keepf = opts.get('keep', False)
122 keepf = opts.get('keep', False)
123 keepbranchesf = opts.get('keepbranches', False)
123 keepbranchesf = opts.get('keepbranches', False)
@@ -76,7 +76,7 def bailifchanged(repo):
76 if modified or added or removed or deleted:
76 if modified or added or removed or deleted:
77 raise util.Abort(_("outstanding uncommitted changes"))
77 raise util.Abort(_("outstanding uncommitted changes"))
78
78
79 def logmessage(opts):
79 def logmessage(ui, opts):
80 """ get the log message according to -m and -l option """
80 """ get the log message according to -m and -l option """
81 message = opts.get('message')
81 message = opts.get('message')
82 logfile = opts.get('logfile')
82 logfile = opts.get('logfile')
@@ -87,7 +87,7 def logmessage(opts):
87 if not message and logfile:
87 if not message and logfile:
88 try:
88 try:
89 if logfile == '-':
89 if logfile == '-':
90 message = sys.stdin.read()
90 message = ui.fin.read()
91 else:
91 else:
92 message = '\n'.join(util.readfile(logfile).splitlines())
92 message = '\n'.join(util.readfile(logfile).splitlines())
93 except IOError, inst:
93 except IOError, inst:
@@ -1163,7 +1163,7 def commit(ui, repo, commitfunc, pats, o
1163 date = opts.get('date')
1163 date = opts.get('date')
1164 if date:
1164 if date:
1165 opts['date'] = util.parsedate(date)
1165 opts['date'] = util.parsedate(date)
1166 message = logmessage(opts)
1166 message = logmessage(ui, opts)
1167
1167
1168 # extract addremove carefully -- this function can be called from a command
1168 # extract addremove carefully -- this function can be called from a command
1169 # that doesn't support addremove
1169 # that doesn't support addremove
@@ -3097,7 +3097,7 def import_(ui, repo, patch1, *patches,
3097 commitid = _('to working directory')
3097 commitid = _('to working directory')
3098
3098
3099 try:
3099 try:
3100 cmdline_message = cmdutil.logmessage(opts)
3100 cmdline_message = cmdutil.logmessage(ui, opts)
3101 if cmdline_message:
3101 if cmdline_message:
3102 # pickup the cmdline msg
3102 # pickup the cmdline msg
3103 message = cmdline_message
3103 message = cmdline_message
General Comments 0
You need to be logged in to leave comments. Login now