[Differential] [Updated, 25 lines] D65: histedit: create transaction outside of try
martinvonz (Martin von Zweigbergk)
phabricator at mercurial-scm.org
Thu Jul 13 16:01:37 EDT 2017
martinvonz updated this revision to Diff 115.
martinvonz marked an inline comment as done.
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D65?vs=99&id=115
REVISION DETAIL
https://phab.mercurial-scm.org/D65
AFFECTED FILES
hgext/histedit.py
CHANGE DETAILS
Index: hgext/histedit.py
===================================================================
--- hgext/histedit.py
+++ hgext/histedit.py
@@ -1107,23 +1107,22 @@
if action.verb == 'fold' and nextact and nextact.verb == 'fold':
state.actions[idx].__class__ = _multifold
- total = len(state.actions)
- pos = 0
- tr = None
-
# Force an initial state file write, so the user can run --abort/continue
# even if there's an exception before the first transaction serialize.
state.write()
+
+ total = len(state.actions)
+ pos = 0
+ tr = None
+ # Don't use singletransaction by default since it rolls the entire
+ # transaction back if an unexpected exception happens (like a
+ # pretxncommit hook throws, or the user aborts the commit msg editor).
+ if ui.configbool("histedit", "singletransaction", False):
+ # Don't use a 'with' for the transaction, since actions may close
+ # 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:
- # Don't use singletransaction by default since it rolls the entire
- # transaction back if an unexpected exception happens (like a
- # pretxncommit hook throws, or the user aborts the commit msg editor).
- if ui.configbool("histedit", "singletransaction", False):
- # Don't use a 'with' for the transaction, since actions may close
- # 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')
-
while state.actions:
state.write(tr=tr)
actobj = state.actions[0]
EMAIL PREFERENCES
https://phab.mercurial-scm.org/settings/panel/emailpreferences/
To: martinvonz, #hg-reviewers, dsp, durham
Cc: durham, mercurial-devel, indygreg
More information about the Mercurial-devel
mailing list