Mercurial > evolve
diff hgext/evolve.py @ 1408:b3afdc0815d0
evolve: skip unstable changesets with multiple successorssets
We were previously crashing when encountering them, but we want to be able to
solve the other solvable troubles instead of stopping right there.
author | Laurent Charignon <lcharignon@fb.com> |
---|---|
date | Tue, 16 Jun 2015 17:56:23 -0700 |
parents | 552687eb4856 |
children | 3276730e4b32 |
line wrap: on
line diff
--- a/hgext/evolve.py Fri Jun 19 14:18:45 2015 -0700 +++ b/hgext/evolve.py Tue Jun 16 17:56:23 2015 -0700 @@ -1260,6 +1260,16 @@ if repo['.'] != startnode: ui.status(_('working directory is now at %s\n') % repo['.']) +class MultipleSuccessorsError(RuntimeError): + """Exception raised by _singlesuccessor when multiple sucessors sets exists + + The object contains the list of successorssets in its 'successorssets' + attribute to call to easily recover. + """ + + def __init__(self, successorssets): + self.successorssets = successorssets + def _singlesuccessor(repo, p): """returns p (as rev) if not obsolete or its unique latest successors @@ -1278,7 +1288,8 @@ obs = obs.parents()[0] newer = obsolete.successorssets(repo, obs.node()) if len(newer) > 1: - raise util.Abort(_("conflict rewriting. can't choose destination\n")) + raise MultipleSuccessorsError(newer) + return repo[newer[0][0]].rev() def builddependencies(repo, revs): @@ -1296,7 +1307,10 @@ for r in revs: dependencies[r] = set() for p in repo[r].parents(): - succ = _singlesuccessor(repo, p) + try: + succ = _singlesuccessor(repo, p) + except MultipleSuccessorsError, exc: + dependencies[r] = exc.successorssets if succ in revs: dependencies[r].add(succ) rdependencies[succ].add(r)