# HG changeset patch # User Laurent Charignon # Date 1434502583 25200 # Node ID b3afdc0815d084c5b53b308f8d7567746836f34c # Parent 552687eb4856ee5a663ece417feffffa94e671a0 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. diff -r 552687eb4856 -r b3afdc0815d0 hgext/evolve.py --- 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) diff -r 552687eb4856 -r b3afdc0815d0 tests/test-evolve-order.t --- a/tests/test-evolve-order.t Fri Jun 19 14:18:45 2015 -0700 +++ b/tests/test-evolve-order.t Tue Jun 16 17:56:23 2015 -0700 @@ -233,5 +233,30 @@ o 15:225d2cc5d3fc@default(draft) add _d | +Test multiple revision with some un-evolvable because parent is splitted +------------------------------------------------------------------------ + $ hg up 'desc(c2prime)' + 0 files updated, 0 files merged, 2 files removed, 0 files unresolved + $ mkcommit c3part1 + created new head + $ hg prev + 0 files updated, 0 files merged, 1 files removed, 0 files unresolved + [29] add c2prime + $ mkcommit c3part2 + created new head + $ hg prune -s 'desc(c3part1)' 'desc(c3_)' + 1 changesets pruned + 1 new unstable changesets + $ hg prune -s 'desc(c3part2)' 'desc(c3_)' + 1 changesets pruned + 2 new divergent changesets + $ hg up 'desc(b3prime)' + 2 files updated, 0 files merged, 3 files removed, 0 files unresolved + $ hg amend -m 'b3second' + 1 new unstable changesets + $ hg evolve --rev 'unstable()' + move:[30] add b4_ + atop:[35] b3second + working directory is now at a51a8a82fdba