evolve: check that relocating makes sense in _solvedivergent() (issue5958) stable
authorAnton Shestakov <av6@dwimlabs.net>
Mon, 09 Sep 2019 09:28:47 +0700
branchstable
changeset 4850 6d898fa6e5c3
parent 4849 b9b6f421688a
child 4857 86cdc5efd769
evolve: check that relocating makes sense in _solvedivergent() (issue5958)
CHANGELOG
hgext3rd/evolve/evolvecmd.py
tests/test-evolve-issue5958.t
--- a/CHANGELOG	Wed Oct 24 19:32:04 2018 +0200
+++ b/CHANGELOG	Mon Sep 09 09:28:47 2019 +0700
@@ -4,6 +4,7 @@
 9.1.1 - in progress
 -------------------
 
+  * evolve: check that relocating makes sense in _solvedivergent() (issue5958)
   * evolve: test that target is not orig in _solveunstable() (issue6097)
   * fold: check allowdivergence before folding obsolete changesets (issue5817)
   * obslog: correct spacing of patch output with word-diff=yes (issue6175)
--- a/hgext3rd/evolve/evolvecmd.py	Wed Oct 24 19:32:04 2018 +0200
+++ b/hgext3rd/evolve/evolvecmd.py	Mon Sep 09 09:28:47 2019 +0700
@@ -502,6 +502,10 @@
                  % divergent))
         return (False, ".")
 
+    # Sometimes we already have the other cset where we want it
+    if relocatereq and other == divergent.p1():
+        relocatereq = False
+
     evolvestate['resolutionparent'] = resolutionparent
     # relocate the other divergent if required
     if relocatereq:
--- a/tests/test-evolve-issue5958.t	Wed Oct 24 19:32:04 2018 +0200
+++ b/tests/test-evolve-issue5958.t	Mon Sep 09 09:28:47 2019 +0700
@@ -79,17 +79,10 @@
        rewritten(date) as 0065551bd38f using metaedit by test (Thu Jan 01 00:00:00 1970 +0000)
        rewritten(date) as c17bf400a278 using metaedit by test (Thu Jan 01 00:00:00 1970 +0000)
   
-  $ hg evolve --content-divergent 2>&1 | grep '^\S'
+  $ hg evolve --content-divergent
   merge:[6] add foo.txt
   with: [4] add foo.txt
   base: [1] add foo.txt
-  rebasing "other" content-divergent changeset c17bf400a278 on c17bf400a278
-  ** 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
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  1 new orphan changesets
+  working directory is now at 2372e6d39855