Patchwork [STABLE] graft: fix printing of --continue command

login
register
mail settings
Submitter Adam Simpkins
Date April 28, 2016, 8:09 p.m.
Message ID <6fc8c1e263cf95cc5cd0.1461874197@devbig126.prn1.facebook.com>
Download mbox | patch
Permalink /patch/14825/
State Accepted
Headers show

Comments

Adam Simpkins - April 28, 2016, 8:09 p.m.
# HG changeset patch
# User Adam Simpkins <simpkins@fb.com>
# Date 1461810271 25200
#      Wed Apr 27 19:24:31 2016 -0700
# Branch stable
# Node ID 6fc8c1e263cf95cc5cd023c83187c134dc79d81a
# Parent  87d4a6c5567e81386b8c2209d95060d5bf72e064
graft: fix printing of --continue command

Properly shell quote arguments, to avoid printing commands that won't work when
run literally.  For example, a date string with timestamp needs to be quoted:
--date '1456953053 28800'
timeless - April 29, 2016, 12:22 a.m.
looks good to me, thanks.

On Thu, Apr 28, 2016 at 4:09 PM, Adam Simpkins <simpkins@fb.com> wrote:
> # HG changeset patch
> # User Adam Simpkins <simpkins@fb.com>
> # Date 1461810271 25200
> #      Wed Apr 27 19:24:31 2016 -0700
> # Branch stable
> # Node ID 6fc8c1e263cf95cc5cd023c83187c134dc79d81a
> # Parent  87d4a6c5567e81386b8c2209d95060d5bf72e064
> graft: fix printing of --continue command
>
> Properly shell quote arguments, to avoid printing commands that won't work when
> run literally.  For example, a date string with timestamp needs to be quoted:
> --date '1456953053 28800'
>
> diff --git a/mercurial/commands.py b/mercurial/commands.py
> --- a/mercurial/commands.py
> +++ b/mercurial/commands.py
> @@ -4231,9 +4231,9 @@
>                  repo.vfs.write('graftstate', ''.join(nodelines))
>                  extra = ''
>                  if opts.get('user'):
> -                    extra += ' --user %s' % opts['user']
> +                    extra += ' --user %s' % util.shellquote(opts['user'])
>                  if opts.get('date'):
> -                    extra += ' --date %s' % opts['date']
> +                    extra += ' --date %s' % util.shellquote(opts['date'])
>                  if opts.get('log'):
>                      extra += ' --log'
>                  hint=_("use 'hg resolve' and 'hg graft --continue%s'") % extra
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Matt Mackall - April 29, 2016, 8:26 p.m.
On Thu, 2016-04-28 at 13:09 -0700, Adam Simpkins wrote:
> # HG changeset patch
> # User Adam Simpkins <simpkins@fb.com>
> # Date 1461810271 25200
> #      Wed Apr 27 19:24:31 2016 -0700
> # Branch stable
> # Node ID 6fc8c1e263cf95cc5cd023c83187c134dc79d81a
> # Parent  87d4a6c5567e81386b8c2209d95060d5bf72e064
> graft: fix printing of --continue command

Queued for stable, thanks.

-- 
Mathematics is the supreme nostalgia of our time.

Patch

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -4231,9 +4231,9 @@ 
                 repo.vfs.write('graftstate', ''.join(nodelines))
                 extra = ''
                 if opts.get('user'):
-                    extra += ' --user %s' % opts['user']
+                    extra += ' --user %s' % util.shellquote(opts['user'])
                 if opts.get('date'):
-                    extra += ' --date %s' % opts['date']
+                    extra += ' --date %s' % util.shellquote(opts['date'])
                 if opts.get('log'):
                     extra += ' --log'
                 hint=_("use 'hg resolve' and 'hg graft --continue%s'") % extra