dispatch: consolidate formatting of arguments
authorAugie Fackler <augie@google.com>
Sun, 19 Mar 2017 00:18:53 -0400
changeset 31492 3c77414a0f9c
parent 31491 492c64afc54c
child 31493 7e9c7d1d65cb
dispatch: consolidate formatting of arguments This was getting done twice, and it's clever enough I'm about to split it apart and then fix it for Python 3.
mercurial/dispatch.py
--- a/mercurial/dispatch.py	Fri Mar 17 05:10:58 2017 +0530
+++ b/mercurial/dispatch.py	Sun Mar 19 00:18:53 2017 -0400
@@ -92,6 +92,9 @@
     if inst.hint:
         write(_("(%s)\n") % inst.hint)
 
+def _formatargs(args):
+    return ' '.join(' ' in a and repr(a) or a for a in args)
+
 def dispatch(req):
     "run the command specified in req.args"
     if req.ferr:
@@ -123,7 +126,7 @@
         _formatparse(ferr.write, inst)
         return -1
 
-    msg = ' '.join(' ' in a and repr(a) or a for a in req.args)
+    msg = _formatargs(req.args)
     starttime = util.timer()
     ret = None
     try:
@@ -829,7 +832,7 @@
         elif rpath:
             ui.warn(_("warning: --repository ignored\n"))
 
-        msg = ' '.join(' ' in a and repr(a) or a for a in fullargs)
+        msg = _formatargs(fullargs)
         ui.log("command", '%s\n', msg)
         strcmdopt = pycompat.strkwargs(cmdoptions)
         d = lambda: util.checksignature(func)(ui, *args, **strcmdopt)