Mercurial > evolve
changeset 5050:f29bd1c7e457
evolve: use utility._singlesuccessor() in _solveunstable()
author | Sushil khanchi <sushilkhanchi97@gmail.com> |
---|---|
date | Sat, 07 Dec 2019 23:13:40 +0530 |
parents | 1b393870c6b9 |
children | 9346f0e934be |
files | hgext3rd/evolve/evolvecmd.py hgext3rd/evolve/utility.py |
diffstat | 2 files changed, 13 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- 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