evolve: test that target is not orig in _solveunstable() (issue6097) stable
authorAnton Shestakov <av6@dwimlabs.net>
Tue, 03 Sep 2019 13:02:20 +0700
branchstable
changeset 4825 9af212b8565a
parent 4824 f9d436b64b3f
child 4826 efc76b1563f0
child 4827 4c6dd20e8cc2
evolve: test that target is not orig in _solveunstable() (issue6097) `newer` is the result of obsutil.successorssets() and can be [[orig.node()]], in which case later on in this function evolve will try to rebase orig onto orig, which is not correct. So let's just check this particular case. This fix doesn't cover cases when successorssets() result contains orig.node() not at [0][0]. Such cases need tests.
hgext3rd/evolve/evolvecmd.py
tests/test-evolve-issue6097.t
--- a/hgext3rd/evolve/evolvecmd.py	Mon Sep 02 11:17:23 2019 +0700
+++ b/hgext3rd/evolve/evolvecmd.py	Tue Sep 03 13:02:20 2019 +0700
@@ -124,8 +124,8 @@
         return (False, ".")
     obs = pctx
     newer = obsutil.successorssets(repo, obs.node())
-    # search of a parent which is not killed
-    while not newer or newer == [()]:
+    # search of a parent which is not killed, but also isn't the orig
+    while not newer or newer == [()] or newer[0][0] == orig.node():
         ui.debug("stabilize target %s is plain dead,"
                  " trying to stabilize on its parent\n" %
                  obs)
--- a/tests/test-evolve-issue6097.t	Mon Sep 02 11:17:23 2019 +0700
+++ b/tests/test-evolve-issue6097.t	Tue Sep 03 13:02:20 2019 +0700
@@ -71,17 +71,29 @@
        rewritten(description, content) as 32acf8fb1b23 using amend by test (Thu Jan 01 00:00:00 1970 +0000)
   
 
-FIXME: obviously a traceback is not good
-
-  $ hg evolve -r . 2>&1 | grep '^\S'
+  $ hg evolve -r .
   move:[3] apricot and coconut
-  atop:[3] apricot and coconut
-  ** unknown exception encountered, please report by visiting
-  ** https://mercurial-scm.org/wiki/BugTracker
-  ** Python * (glob)
-  ** Mercurial Distributed SCM (*) (glob)
-  ** Extensions loaded: rebase, evolve
-  ** ProgrammingError: tried to relocate a node on top of itself
-  ** (This shouldn't happen. If you still need to move changesets, please do so manually with nothing to rebase - working directory parent is also destination)
-  Traceback (most recent call last):
-  mercurial.error.ProgrammingError: tried to relocate a node on top of itself
+  atop:[-1] 
+  working directory is now at bb847d1d3a5f
+
+  $ hg log -G
+  @  changeset:   4:bb847d1d3a5f
+     tag:         tip
+     parent:      -1:000000000000
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     apricot and coconut
+  
+
+  $ hg obslog
+  @  bb847d1d3a5f (4) apricot and coconut
+  |
+  x  2868fe6df617 (3) apricot and coconut
+  |    rewritten(parent) as bb847d1d3a5f using evolve by test (Thu Jan 01 00:00:00 1970 +0000)
+  |
+  x  32acf8fb1b23 (2) apricot and coconut
+  |    rewritten(parent, content) as 2868fe6df617 using rebase by test (Thu Jan 01 00:00:00 1970 +0000)
+  |
+  x  692cc7b6212c (0) apricot
+       rewritten(description, content) as 32acf8fb1b23 using amend by test (Thu Jan 01 00:00:00 1970 +0000)
+