# HG changeset patch # User Idan Kamara # Date 2011-06-08 11:54:52 # Node ID 217b7d83afc3796813b7bb1ebbbec7bab1206d0e # Parent 1679d73c9464252de2135ec05b98088075f1a216 cmdutil, logmessage: use ui.fin when reading from '-' diff --git a/hgext/fetch.py b/hgext/fetch.py --- a/hgext/fetch.py +++ b/hgext/fetch.py @@ -122,7 +122,7 @@ def fetch(ui, repo, source='default', ** if not err: # we don't translate commit messages - message = (cmdutil.logmessage(opts) or + message = (cmdutil.logmessage(ui, opts) or ('Automated merge with %s' % util.removeauth(other.url()))) editor = cmdutil.commiteditor diff --git a/hgext/mq.py b/hgext/mq.py --- a/hgext/mq.py +++ b/hgext/mq.py @@ -2211,7 +2211,7 @@ def new(ui, repo, patch, *args, **opts): Returns 0 on successful creation of a new patch. """ - msg = cmdutil.logmessage(opts) + msg = cmdutil.logmessage(ui, opts) def getmsg(): return ui.edit(msg, opts.get('user') or ui.username()) q = repo.mq @@ -2262,7 +2262,7 @@ def refresh(ui, repo, *pats, **opts): Returns 0 on success. """ q = repo.mq - message = cmdutil.logmessage(opts) + message = cmdutil.logmessage(ui, opts) if opts.get('edit'): if not q.applied: ui.write(_("no patches applied\n")) @@ -2332,7 +2332,7 @@ def fold(ui, repo, *files, **opts): raise util.Abort(_('no patches applied')) q.checklocalchanges(repo) - message = cmdutil.logmessage(opts) + message = cmdutil.logmessage(ui, opts) if opts.get('edit'): if message: raise util.Abort(_('option "-e" incompatible with "-m" or "-l"')) @@ -2661,7 +2661,7 @@ def save(ui, repo, **opts): This command is deprecated, use :hg:`rebase` instead.""" q = repo.mq - message = cmdutil.logmessage(opts) + message = cmdutil.logmessage(ui, opts) ret = q.save(repo, msg=message) if ret: return ret diff --git a/hgext/rebase.py b/hgext/rebase.py --- a/hgext/rebase.py +++ b/hgext/rebase.py @@ -117,7 +117,7 @@ def rebase(ui, repo, **opts): contf = opts.get('continue') abortf = opts.get('abort') collapsef = opts.get('collapse', False) - collapsemsg = cmdutil.logmessage(opts) + collapsemsg = cmdutil.logmessage(ui, opts) extrafn = opts.get('extrafn') # internal, used by e.g. hgsubversion keepf = opts.get('keep', False) keepbranchesf = opts.get('keepbranches', False) diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -76,7 +76,7 @@ def bailifchanged(repo): if modified or added or removed or deleted: raise util.Abort(_("outstanding uncommitted changes")) -def logmessage(opts): +def logmessage(ui, opts): """ get the log message according to -m and -l option """ message = opts.get('message') logfile = opts.get('logfile') @@ -87,7 +87,7 @@ def logmessage(opts): if not message and logfile: try: if logfile == '-': - message = sys.stdin.read() + message = ui.fin.read() else: message = '\n'.join(util.readfile(logfile).splitlines()) except IOError, inst: @@ -1163,7 +1163,7 @@ def commit(ui, repo, commitfunc, pats, o date = opts.get('date') if date: opts['date'] = util.parsedate(date) - message = logmessage(opts) + message = logmessage(ui, opts) # extract addremove carefully -- this function can be called from a command # that doesn't support addremove diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -3097,7 +3097,7 @@ def import_(ui, repo, patch1, *patches, commitid = _('to working directory') try: - cmdline_message = cmdutil.logmessage(opts) + cmdline_message = cmdutil.logmessage(ui, opts) if cmdline_message: # pickup the cmdline msg message = cmdline_message