evolve: strip the extra obsmarkers if any on `hg evolve --abort`
Previous patches started storing some obsmarkers which needs to stripped during
`evolve --abort` which can't be stripped by stripping the new evolved changesets
because they point to a node which existed before the evolution was performed.
This patch adds logic to strip those obsmarkers by finding their indices in the
obsstore and then stripping them.
--- a/hgext3rd/evolve/evolvecmd.py Mon Jun 11 20:13:36 2018 +0530
+++ b/hgext3rd/evolve/evolvecmd.py Mon Jun 11 20:17:56 2018 +0530
@@ -1548,6 +1548,23 @@
"branch\n"))
cleanup = False
+ # finding the indices of the obsmarkers to be stripped and stripping
+ # them
+ if evolvestate['obsmarkers']:
+ stripmarkers = set()
+ for m in evolvestate['obsmarkers']:
+ m = (m[0], m[1])
+ stripmarkers.add(m)
+ indices = []
+ allmarkers = obsutil.getmarkers(repo)
+ for i, m in enumerate(allmarkers):
+ marker = (m.prednode(), m.succnodes()[0])
+ if marker in stripmarkers:
+ indices.append(i)
+
+ repair.deleteobsmarkers(repo.obsstore, indices)
+ repo.ui.debug('deleted %d obsmarkers\n' % len(indices))
+
if cleanup:
if evolvedrevs:
strippoints = [c.node()
--- a/tests/test-evolve-abort-contentdiv.t Mon Jun 11 20:13:36 2018 +0530
+++ b/tests/test-evolve-abort-contentdiv.t Mon Jun 11 20:17:56 2018 +0530
@@ -174,7 +174,7 @@
| () draft
| x 9:7398f702a162 added c
|/ () draft
- | o 8:2ba73e31f264 added c
+ | * 8:2ba73e31f264 added c
|/ () draft
| * 7:f0f1694f123e added d
| | () draft
@@ -193,14 +193,12 @@
o 0:8fa14d15e168 added hgignore
() draft
-XXX: we need to strip off the obsmarker created 10 -> 8
$ hg obslog -r . --all
- o 2ba73e31f264 (8) added c
- |\
- @ | 491e10505bae (10) added c
- | | rewritten as 2ba73e31f264 using evolve by test (Thu Jan 01 00:00:00 1970 +0000)
+ * 2ba73e31f264 (8) added c
+ |
+ | @ 491e10505bae (10) added c
| |
- x | 7398f702a162 (9) added c
+ | x 7398f702a162 (9) added c
|/ rewritten(content) as 491e10505bae using amend by test (Thu Jan 01 00:00:00 1970 +0000)
|
x ca1b80f7960a (3) added c