evolve: orphans that evolve into nothing don't need successors (issue5967)
When continuing to solve an orphan that created no changes (i.e. clean wdir),
_completeorphan() used to create an obsmarker that said that the result of that
orphan evolution is the currently checked out changeset. That's not a correct
obsmarker, because all of the orphan's changes were dropped and so it had no
effect on the currently checked out changeset.
This is an issue that has only existed when --continu'ing evolve, that's why
the fix touches _completeorphan(), but not _solveunstable(). This fix is
adapted from a similar "if node is None" block in _finalizerelocate().
--- a/CHANGELOG Sat Dec 22 18:31:32 2018 +0800
+++ b/CHANGELOG Tue Jun 18 17:17:31 2019 +0800
@@ -5,6 +5,7 @@
-------------------
* pick: no longer forget file in case of conflict (issue6037)
+ * evolve: properly prune changeset with no change in case of conflict (issue5967)
9.0.0 -- 2019-06-06
-------------------
--- a/hgext3rd/evolve/evolvecmd.py Sat Dec 22 18:31:32 2018 +0800
+++ b/hgext3rd/evolve/evolvecmd.py Tue Jun 18 17:17:31 2019 +0800
@@ -2052,8 +2052,11 @@
if node is None:
repo.ui.status(_("evolution of %d:%s created no changes"
" to commit\n") % (ctx.rev(), ctx))
- newctx = repo[node] if node is not None else repo['.']
- obsolete.createmarkers(repo, [(ctx, (newctx,))], operation='evolve')
+ replacement = ()
+ else:
+ replacement = (repo[node],)
+
+ obsolete.createmarkers(repo, [(ctx, replacement)], operation='evolve')
# make sure we are continuing evolve and not `hg next --evolve`
if evolvestate['command'] == 'evolve':
--- a/tests/test-evolve-issue5967.t Sat Dec 22 18:31:32 2018 +0800
+++ b/tests/test-evolve-issue5967.t Tue Jun 18 17:17:31 2019 +0800
@@ -58,21 +58,16 @@
$ hg glog
@ 2: apricot
+
+This is important: 1 should not have a successor (especially not revision 2)
+
$ hg olog --all
- @ 4d6fec23dcc4 (2) apricot
- |\
- x | 3ba7db0ce860 (0) apple
- / rewritten(description, content) as 4d6fec23dcc4 using amend by test (Thu Jan 01 00:00:00 1970 +0000)
+ @ 4d6fec23dcc4 (2) apricot
|
- x dd9b5dd30cd6 (1) banana
- rewritten(description, parent, content) as 4d6fec23dcc4 using evolve by test (Thu Jan 01 00:00:00 1970 +0000)
+ x 3ba7db0ce860 (0) apple
+ rewritten(description, content) as 4d6fec23dcc4 using amend by test (Thu Jan 01 00:00:00 1970 +0000)
$ hg olog --hidden --all 1
- @ 4d6fec23dcc4 (2) apricot
- |\
- x | 3ba7db0ce860 (0) apple
- / rewritten(description, content) as 4d6fec23dcc4 using amend by test (Thu Jan 01 00:00:00 1970 +0000)
- |
x dd9b5dd30cd6 (1) banana
- rewritten(description, parent, content) as 4d6fec23dcc4 using evolve by test (Thu Jan 01 00:00:00 1970 +0000)
+ pruned using evolve by test (Thu Jan 01 00:00:00 1970 +0000)