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.
--- 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