From patchwork Sun Mar 19 06:11:32 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [1,of,8,py3] dispatch: consolidate formatting of arguments From: Augie Fackler X-Patchwork-Id: 19440 Message-Id: To: mercurial-devel@mercurial-scm.org Date: Sun, 19 Mar 2017 02:11:32 -0400 # HG changeset patch # User Augie Fackler # Date 1489897133 14400 # Sun Mar 19 00:18:53 2017 -0400 # Node ID ea399732bc91813286b8f40082ec33a6a16b3558 # Parent 291951ad070b3fa39dd1d83503aa1011a20d9a21 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)