diff mercurial/dispatch.py @ 31500:bc315e669a32

dispatch: replace mayberepr with shellquote The quoting logic here was actually insufficient, and would have had bogus b-prefixes on Python 3. shellquote seems more appropriate anyway. Surprisingly, only two tests have output changes, and both of them look reasonable to me (both are in blackbox logs). Spotted by Yuya during review.
author Augie Fackler <augie@google.com>
date Sun, 19 Mar 2017 14:23:30 -0400
parents faf75a701aca
children 9916b3d579a9
line wrap: on
line diff
--- a/mercurial/dispatch.py	Sun Mar 19 12:44:45 2017 -0400
+++ b/mercurial/dispatch.py	Sun Mar 19 14:23:30 2017 -0400
@@ -92,13 +92,8 @@
     if inst.hint:
         write(_("(%s)\n") % inst.hint)
 
-def _mayberepr(a):
-    if ' ' in a:
-        return encoding.strtolocal(repr(a))
-    return a
-
 def _formatargs(args):
-    return ' '.join(_mayberepr(a) for a in args)
+    return ' '.join(util.shellquote(a) for a in args)
 
 def dispatch(req):
     "run the command specified in req.args"