evolve: make `--abort` strip the temporary revs created during resolution
During divergence resolution, `hg evolve` created temporary relocation commits
which needs to be stripped off during `hg evolve --abort` to get back to the
same state where we were. Previous patch added a new list temprevs to be stored
in evolvestate.
This patch starts storing the temp relocated node created during
phase-divergence resolution in evolvestate and make sure we consider stripping
it too while `hg evolve --abort`.
The test changes demonstrate the fix. Now we are sucessfully aborting a
phase-divergence resolution.
--- a/hgext3rd/evolve/evolvecmd.py Wed May 23 02:43:23 2018 +0530
+++ b/hgext3rd/evolve/evolvecmd.py Wed May 23 02:46:20 2018 +0530
@@ -245,6 +245,7 @@
tmpctx = repo[tmpid]
obsolete.createmarkers(repo, [(bumped, (tmpctx,))],
operation='evolve')
+ evolvestate['temprevs'].append(tmpid)
except MergeFailure:
evolvestate['current'] = bumped.hex()
evolvestate['precursor'] = prec.hex()
@@ -1307,6 +1308,7 @@
""" logic for handling of `hg evolve --abort`"""
with repo.wlock(), repo.lock():
+ repo = repo.unfiltered()
evolvedctx = []
# boolean value to say whether we should strip or not
cleanup = True
@@ -1314,6 +1316,9 @@
for old, new in evolvestate['replacements'].iteritems():
if new:
evolvedctx.append(repo[new])
+ for temp in evolvestate['temprevs']:
+ if temp:
+ evolvedctx.append(repo[temp])
evolvedrevs = [c.rev() for c in evolvedctx]
# checking if phase changed of any of the evolved rev
--- a/tests/test-evolve-abort-phasediv.t Wed May 23 02:43:23 2018 +0530
+++ b/tests/test-evolve-abort-phasediv.t Wed May 23 02:46:20 2018 +0530
@@ -189,27 +189,26 @@
[255]
$ hg evolve --abort
+ 1 new phase-divergent changesets
evolve aborted
working directory is now at 28cd06b3f801
$ hg glog --hidden
- x 10:b7aedbe61ce6 added d
+ @ 9:28cd06b3f801 added c
| () draft
- | @ 9:28cd06b3f801 added c
- | | () draft
- | | x 8:9ff8adbe8a24 added c
- | |/ () draft
- | | x 7:e44ebefe4f54 added d
- | |/ () draft
- | | x 6:ddba58020bc0 added d
- | |/ () draft
- | | x 5:cfe30edc6125 added d
- | |/ () draft
- +---o 4:c41c793e0ef1 added d
- | | () public
- o | 3:ca1b80f7960a added c
+ | x 8:9ff8adbe8a24 added c
+ |/ () draft
+ | * 7:e44ebefe4f54 added d
+ |/ () draft
+ | x 6:ddba58020bc0 added d
+ |/ () draft
+ | x 5:cfe30edc6125 added d
+ |/ () draft
+ | o 4:c41c793e0ef1 added d
| | () public
- o | 2:b1661037fa25 added b
+ | o 3:ca1b80f7960a added c
+ | | () public
+ | o 2:b1661037fa25 added b
|/ () public
o 1:c7586e2a9264 added a
| () public