diff hgext3rd/topic/evolvebits.py @ 3017:0884856a4143 stable

stack: handle basic case of splitting with crash hg stack used to crash horribly whenever a split was encountered. This is no longer the case. If the result of the split (or there successors) produce a sensible linear result with on final head, we can just assume that head is the evolution destination.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Sat, 30 Sep 2017 11:11:04 +0100
parents 66357d4d03b2
children 6aff4bb3970d
line wrap: on
line diff
--- a/hgext3rd/topic/evolvebits.py	Wed Sep 27 16:24:44 2017 +0200
+++ b/hgext3rd/topic/evolvebits.py	Sat Sep 30 11:11:04 2017 +0100
@@ -81,8 +81,16 @@
                  obs)
         obs = obs.parents()[0]
         newer = compat.successorssets(repo, obs.node())
-    if len(newer) > 1 or len(newer[0]) > 1:
+    if 1 < len(newer):
+        # divergence case
+        # we should pick as arbitrary one
         raise MultipleSuccessorsError(newer)
+    elif 1 < len(newer[0]):
+        splitheads = list(repo.revs('heads(%ln::%ln)', newer[0], newer[0]))
+        if 1 < len(splitheads):
+            # split case, See if we can make sense of it.
+            raise MultipleSuccessorsError(newer)
+        return splitheads[0]
 
     return repo[newer[0][0]].rev()