[Request] [+ ] D8578: graft-state: save --base in graft's state, fixing bug with graft --continue
charlesetc (Charles Chamberlain)
phabricator at mercurial-scm.org
Fri May 22 19:37:38 UTC 2020
charlesetc created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.
REVISION SUMMARY
Without this change, running graft --continue after grafting a merge commit using --base
(and encountering conflicts) will output "skipping ungraftable merge revision" even though
we specified a base in the initial graft command.
A test is added in the previous commit. Graft's improve behaviour is reflected in this
test's output.
REPOSITORY
rHG Mercurial
BRANCH
stable
REVISION DETAIL
https://phab.mercurial-scm.org/D8578
AFFECTED FILES
mercurial/commands.py
tests/test-graft.t
CHANGE DETAILS
diff --git a/tests/test-graft.t b/tests/test-graft.t
--- a/tests/test-graft.t
+++ b/tests/test-graft.t
@@ -871,8 +871,7 @@
$ echo a > d && hg resolve -qm
continue: hg graft --continue
$ hg graft --continue
- skipping ungraftable merge revision 6
- [255]
+ grafting 6:25a2b029d3ae "6"
Continue testing same origin policy, using revision numbers from test above
but do some destructive editing of the repo:
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -2969,9 +2969,6 @@
revs = list(revs)
revs.extend(opts.get(b'rev'))
- basectx = None
- if opts.get(b'base'):
- basectx = scmutil.revsingle(repo, opts[b'base'], None)
# a dict of data to be stored in state file
statedata = {}
# list of new nodes created by ongoing graft
@@ -3061,6 +3058,8 @@
opts[b'log'] = True
if statedata.get(b'no_commit'):
opts[b'no_commit'] = statedata.get(b'no_commit')
+ if statedata.get(b'base'):
+ opts[b'base'] = statedata.get(b'base')
nodes = statedata[b'nodes']
revs = [repo[node].rev() for node in nodes]
else:
@@ -3073,6 +3072,9 @@
revs = scmutil.revrange(repo, revs)
skipped = set()
+ basectx = None
+ if opts.get(b'base'):
+ basectx = scmutil.revsingle(repo, opts[b'base'], None)
if basectx is None:
# check for merges
for rev in repo.revs(b'%ld and merge()', revs):
@@ -3165,6 +3167,8 @@
if opts.get(b'no_commit'):
statedata[b'no_commit'] = True
+ if opts.get(b'base'):
+ statedata[b'base'] = True
for pos, ctx in enumerate(repo.set(b"%ld", revs)):
desc = b'%d:%s "%s"' % (
ctx.rev(),
To: charlesetc, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mercurial-scm.org/pipermail/mercurial-patches/attachments/20200522/ec1a4b52/attachment-0001.html>
More information about the Mercurial-patches
mailing list