Patchwork [STABLE] graft: fix --base value to be saved in state file

login
register
mail settings
Submitter Yuya Nishihara
Date June 2, 2020, 12:37 p.m.
Message ID <2dc5ae953c4a8265578a.1591101429@mimosa>
Download mbox | patch
Permalink /patch/46456/
State Accepted
Headers show

Comments

Yuya Nishihara - June 2, 2020, 12:37 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1591098006 -32400
#      Tue Jun 02 20:40:06 2020 +0900
# Branch stable
# Node ID 2dc5ae953c4a8265578acbe7d3e26c93ec8a08fb
# Parent  6d968cd40961b0deda12e1a814a574b0704463ed
graft: fix --base value to be saved in state file

'True' just works because it is treated as an integer revision '1' and
only the truthiness of the basectx is important. If multiple source revisions
were supported with --base, the resumed graft operation would go wrong.
Augie Fackler - June 2, 2020, 10:02 p.m.
queued for stable,  thanks

> On Jun 2, 2020, at 08:37, Yuya Nishihara <yuya@tcha.org> wrote:
> 
> # HG changeset patch
> # User Yuya Nishihara <yuya@tcha.org>
> # Date 1591098006 -32400
> #      Tue Jun 02 20:40:06 2020 +0900
> # Branch stable
> # Node ID 2dc5ae953c4a8265578acbe7d3e26c93ec8a08fb
> # Parent  6d968cd40961b0deda12e1a814a574b0704463ed
> graft: fix --base value to be saved in state file
> 
> 'True' just works because it is treated as an integer revision '1' and
> only the truthiness of the basectx is important. If multiple source revisions
> were supported with --base, the resumed graft operation would go wrong.
> 
> diff --git a/mercurial/commands.py b/mercurial/commands.py
> --- a/mercurial/commands.py
> +++ b/mercurial/commands.py
> @@ -3168,7 +3168,7 @@ def _dograft(ui, repo, *revs, **opts):
>     if opts.get(b'no_commit'):
>         statedata[b'no_commit'] = True
>     if opts.get(b'base'):
> -        statedata[b'base'] = True
> +        statedata[b'base'] = opts[b'base']
>     for pos, ctx in enumerate(repo.set(b"%ld", revs)):
>         desc = b'%d:%s "%s"' % (
>             ctx.rev(),
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Patch

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -3168,7 +3168,7 @@  def _dograft(ui, repo, *revs, **opts):
     if opts.get(b'no_commit'):
         statedata[b'no_commit'] = True
     if opts.get(b'base'):
-        statedata[b'base'] = True
+        statedata[b'base'] = opts[b'base']
     for pos, ctx in enumerate(repo.set(b"%ld", revs)):
         desc = b'%d:%s "%s"' % (
             ctx.rev(),