changeset 14635:217b7d83afc3

cmdutil, logmessage: use ui.fin when reading from '-'
author Idan Kamara <idankk86@gmail.com>
date Wed, 08 Jun 2011 14:54:52 +0300
parents 1679d73c9464
children b98063487a6f
files hgext/fetch.py hgext/mq.py hgext/rebase.py mercurial/cmdutil.py mercurial/commands.py
diffstat 5 files changed, 10 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/fetch.py	Wed Jun 15 17:04:06 2011 -0300
+++ b/hgext/fetch.py	Wed Jun 08 14:54:52 2011 +0300
@@ -122,7 +122,7 @@
 
         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
--- a/hgext/mq.py	Wed Jun 15 17:04:06 2011 -0300
+++ b/hgext/mq.py	Wed Jun 08 14:54:52 2011 +0300
@@ -2211,7 +2211,7 @@
 
     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 @@
     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 @@
         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 @@
 
     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
--- a/hgext/rebase.py	Wed Jun 15 17:04:06 2011 -0300
+++ b/hgext/rebase.py	Wed Jun 08 14:54:52 2011 +0300
@@ -117,7 +117,7 @@
         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)
--- a/mercurial/cmdutil.py	Wed Jun 15 17:04:06 2011 -0300
+++ b/mercurial/cmdutil.py	Wed Jun 08 14:54:52 2011 +0300
@@ -76,7 +76,7 @@
     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 @@
     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 @@
     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
--- a/mercurial/commands.py	Wed Jun 15 17:04:06 2011 -0300
+++ b/mercurial/commands.py	Wed Jun 08 14:54:52 2011 +0300
@@ -3097,7 +3097,7 @@
         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