martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Just a little refactoring to simplify the next patch.

REPOSITORY
  rHG Mercurial

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
@@ -1111,20 +1111,19 @@
     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')
 
     # 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()
     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
Cc: mercurial-devel, indygreg
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to