--- 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)