Mercurial > evolve
changeset 4590:784ad6f60571
evolve: don't use exception for local flow control
The LocalMergeFailure class was added in 3f91654713dd (obsolete Move
merge failure handling into stabilize code, 2012-08-20). I think the
"if compat.hasconflict(r)" check was added later. Now that we have
that check, we should use that for flow control instead.
Note that this means that any unexpected exception from
_relocatecommit() will now just raise (and roll back the
transaction). I think that's an improvement.
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Fri, 19 Apr 2019 10:41:56 -0700 |
parents | 5ba885e2ef5e |
children | 9242b05eb593 |
files | hgext3rd/evolve/evolvecmd.py |
diffstat | 1 files changed, 8 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext3rd/evolve/evolvecmd.py Tue Apr 23 11:02:08 2019 -0700 +++ b/hgext3rd/evolve/evolvecmd.py Fri Apr 19 10:41:56 2019 -0700 @@ -981,25 +981,19 @@ tr = repo.currenttransaction() assert tr is not None - try: - r = _evolvemerge(repo, orig, dest, pctx, keepbranch) - if compat.hasconflict(r): # some conflict - raise error.Abort(_('unresolved merge conflicts ' - '(see hg help resolve)')) - nodenew = _relocatecommit(repo, orig, commitmsg) - except error.Abort as exc: + r = _evolvemerge(repo, orig, dest, pctx, keepbranch) + if compat.hasconflict(r): # some conflict with repo.dirstate.parentchange(): repo.setparents(dest.node(), orig.node()) repo.dirstate.write(tr) # fix up dirstate for copies and renames - copies.duplicatecopies(repo, repo[None], dest.rev(), orig.p1().rev()) + copies.duplicatecopies(repo, repo[None], dest.rev(), + orig.p1().rev()) dirstatedance(repo, dest, orig.node(), None) - - class LocalMergeFailure(MergeFailure, exc.__class__): - pass - exc.__class__ = LocalMergeFailure - tr.close() # to keep changes in this transaction (e.g. dirstate) - raise + tr.close() # to keep changes in this transaction (e.g. dirstate) + raise MergeFailure(_('unresolved merge conflicts ' + '(see hg help resolve)')) + nodenew = _relocatecommit(repo, orig, commitmsg) _finalizerelocate(repo, orig, dest, nodenew, tr, category, evolvestate) return nodenew