Mercurial > hg > evolve
changeset 1504: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 |
files | hgext/evolve.py tests/test-evolve-order.t |
diffstat | 2 files changed, 41 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/evolve.py +++ b/hgext/evolve.py @@ -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)
--- a/tests/test-evolve-order.t +++ b/tests/test-evolve-order.t @@ -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