Patchwork [2,of,3,V2] histedit: pop action after the action is completed

mail settings
Submitter Durham Goode
Date March 10, 2017, 11:58 p.m.
Message ID <>
Download mbox | patch
Permalink /patch/19088/
State Accepted
Headers show


Durham Goode - March 10, 2017, 11:58 p.m.
# HG changeset patch
# User Durham Goode <>
# Date 1489189411 28800
#      Fri Mar 10 15:43:31 2017 -0800
# Node ID 4046a8f85f7c6b025b986aad9104b73ba2680493
# Parent  0c9a2c16ec96fa56206dbb1199f01dcb4ece7c11
histedit: pop action after the action is completed

We only want to pop the action after the action is completed, since if the
action aborts part way through we want it to remain at the front of the list so
continue/abort will start with it.

Previously we relied on the fact that we only serialized the state file at the
beginning of the action, so the pop wasn't serialized until the next iteration
of the loop. In a future patch we will be adding a large transaction around this
area, which means if we pop the list early it might get serialized if the action
throws a user InterventionRequired error, at which point the action is not in
the list anymore. So let's only pop it once the action is really truly done.


diff --git a/hgext/ b/hgext/
--- a/hgext/
+++ b/hgext/
@@ -1107,7 +1107,7 @@  def _continuehistedit(ui, repo, state):
     pos = 0
     while state.actions:
-        actobj = state.actions.pop(0)
+        actobj = state.actions[0]
         pos += 1
         ui.progress(_("editing"), pos, actobj.torule(),
                     _('changes'), total)
@@ -1116,6 +1116,7 @@  def _continuehistedit(ui, repo, state):
         parentctx, replacement_ =
         state.parentctxnode = parentctx.node()
+        state.actions.pop(0)
     ui.progress(_("editing"), None)