hgext3rd/evolve/__init__.py
changeset 4252 a07cd1d076bb
parent 4250 781d058d14f9
child 4253 35dac5aadcfc
--- a/hgext3rd/evolve/__init__.py	Tue Nov 06 15:10:56 2018 +0530
+++ b/hgext3rd/evolve/__init__.py	Tue Nov 06 10:41:50 2018 +0530
@@ -1146,6 +1146,16 @@
             filtered.update(repo[c] for c in aspchildren
                             if repo[c].topic() != topic)
             aspchildren = [ctx for ctx in aspchildren if ctx not in filtered]
+
+        # To catch and prevent the case when `next` would get confused by split,
+        # lets filter those aspiring children which can be stablized on one of
+        # the aspiring children itself.
+        aspirants = set(aspchildren)
+        for aspchild in aspchildren:
+            possdests = evolvecmd._possibledestination(repo, aspchild)
+            if possdests & aspirants:
+                filtered.add(aspchild)
+        aspchildren = [ctx for ctx in aspchildren if ctx not in filtered]
         if aspchildren:
             needevolve = True