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.
--- 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)