--- a/hgext3rd/evolve/evolvecmd.py Wed Dec 18 16:21:37 2019 +0100
+++ b/hgext3rd/evolve/evolvecmd.py Sat Dec 07 23:13:40 2019 +0530
@@ -122,23 +122,22 @@
ui.warn(_(b"cannot solve instability of %s, skipping\n") % orig)
return (False, b".")
obs = pctx
- if True:
- newer = obsutil.successorssets(repo, obs.node())
- # search of a parent which is not killed, but also isn't the orig
- while not newer or newer[0][0] == orig.node():
- ui.debug(b"stabilize target %s is plain dead,"
- b" trying to stabilize on its parent\n" %
- obs)
- obs = obs.p1()
- newer = obsutil.successorssets(repo, obs.node())
- if len(newer) > 1:
+ try:
+ newer = utility._singlesuccessor(repo, obs)
+ # search of a parent which isn't the orig
+ while repo[newer].node() == orig.node():
+ obs = obs.parents()[0]
+ newer = utility._singlesuccessor(repo, obs)
+ target = newer
+ except utility.MultipleSuccessorsError as exc:
+ if exc.divergenceflag:
msg = _(b"skipping %s: divergent rewriting. can't choose "
b"destination\n") % obs
ui.write_err(msg)
return (False, b".")
- targets = newer[0]
+ targets = exc.successorssets[0]
assert targets
- if len(targets) > 1:
+ if exc.splitflag:
# split target, figure out which one to pick, are they all in line?
targetrevs = [repo[r].rev() for r in targets]
roots = repo.revs(b'roots(%ld)', targetrevs)
--- a/hgext3rd/evolve/utility.py Wed Dec 18 16:21:37 2019 +0100
+++ b/hgext3rd/evolve/utility.py Sat Dec 07 23:13:40 2019 +0530
@@ -75,6 +75,8 @@
def __init__(self, successorssets):
self.successorssets = successorssets
+ self.divergenceflag = len(successorssets) > 1
+ self.splitflag = len(successorssets[0]) > 1
def builddependencies(repo, revs):
"""returns dependency graphs giving an order to solve instability of revs