WIP: fix draft
authorManuel Jacob <me@manueljacob.de>
Thu, 12 Mar 2020 06:18:57 +0100
changeset 5261 df8dc1963ceb
parent 5260 68d8c0cc08c4
WIP: fix
hgext3rd/evolve/utility.py
--- a/hgext3rd/evolve/utility.py	Thu Mar 12 03:13:17 2020 +0100
+++ b/hgext3rd/evolve/utility.py	Thu Mar 12 06:18:57 2020 +0100
@@ -5,6 +5,8 @@
 # This software may be used and distributed according to the terms of the
 # GNU General Public License version 2 or any later version.
 
+import collections
+
 from mercurial import (
     obsutil,
 )
@@ -110,17 +112,18 @@
 
     if not p.obsolete():
         return p.rev()
-    obs = repo[p]
+    tovisit = collections.deque([repo[p]])
     ui = repo.ui
     # search of a parent which is not killed
-    while True:
+    while tovisit:
+        obs = tovisit.popleft()
         newer = obsutil.successorssets(repo, obs.node())
         if newer:
             break
         ui.debug(b"stabilize target %s is plain dead,"
-                 b" trying to stabilize on its parent\n" %
+                 b" trying to stabilize on its parents\n" %
                  obs)
-        obs = obs.p1()
+        tovisit.extend(obs.parents())
     if len(newer) > 1 or len(newer[0]) > 1:
         raise MultipleSuccessorsError(newer)