Mercurial > hg
comparison 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 |
comparison
equal
deleted
inserted
replaced
31499:31d2ddfd338c | 31500:bc315e669a32 |
---|---|
90 write(_("hg: parse error: %s\n") % inst.args[0]) | 90 write(_("hg: parse error: %s\n") % inst.args[0]) |
91 _reportsimilar(write, similar) | 91 _reportsimilar(write, similar) |
92 if inst.hint: | 92 if inst.hint: |
93 write(_("(%s)\n") % inst.hint) | 93 write(_("(%s)\n") % inst.hint) |
94 | 94 |
95 def _mayberepr(a): | |
96 if ' ' in a: | |
97 return encoding.strtolocal(repr(a)) | |
98 return a | |
99 | |
100 def _formatargs(args): | 95 def _formatargs(args): |
101 return ' '.join(_mayberepr(a) for a in args) | 96 return ' '.join(util.shellquote(a) for a in args) |
102 | 97 |
103 def dispatch(req): | 98 def dispatch(req): |
104 "run the command specified in req.args" | 99 "run the command specified in req.args" |
105 if req.ferr: | 100 if req.ferr: |
106 ferr = req.ferr | 101 ferr = req.ferr |