Mercurial > hg-stable
diff hgext/histedit.py @ 33446:fad6852cf879
histedit: extract InterventionRequired transaction handling to utils
rebase will have similar logic, so let's extract it. Besides, it makes
the histedit code more readable.
We may want to parametrize acceptintervention() by the exception(s)
that should result in transaction close.
Differential Revision: https://phab.mercurial-scm.org/D66
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Wed, 12 Jul 2017 13:57:03 -0700 |
parents | 0491004e2233 |
children | af402f11cb9d |
line wrap: on
line diff
--- a/hgext/histedit.py Wed Jul 12 13:17:49 2017 -0700 +++ b/hgext/histedit.py Wed Jul 12 13:57:03 2017 -0700 @@ -1122,7 +1122,7 @@ # and reopen a transaction. For example, if the action executes an # external process it may choose to commit the transaction first. tr = repo.transaction('histedit') - try: + with util.acceptintervention(tr): while state.actions: state.write(tr=tr) actobj = state.actions[0] @@ -1136,17 +1136,6 @@ state.replacements.extend(replacement_) state.actions.pop(0) - if tr is not None: - tr.close() - except error.InterventionRequired: - if tr is not None: - tr.close() - raise - except Exception: - if tr is not None: - tr.abort() - raise - state.write() ui.progress(_("editing"), None)