# HG changeset patch # User Augie Fackler # Date 2017-03-19 04:18:53 # Node ID 3c77414a0f9c38ba6b1eacfb6561fa0b41bfe95a # Parent 492c64afc54c3911df2304dbcf873a5b2b9e205c 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. diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py --- a/mercurial/dispatch.py +++ b/mercurial/dispatch.py @@ -92,6 +92,9 @@ def _formatparse(write, inst): 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 @@ def dispatch(req): _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 @@ def _dispatch(req): 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)