histedit: pop action after the action is completed
authorDurham Goode <durham@fb.com>
Fri, 10 Mar 2017 15:43:31 -0800
changeset 31512 16f8107a489c
parent 31511 fa8aaff2001a
child 31513 68474b72ea63
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.
hgext/histedit.py
--- a/hgext/histedit.py	Fri Mar 10 15:43:31 2017 -0800
+++ b/hgext/histedit.py	Fri Mar 10 15:43:31 2017 -0800
@@ -1100,7 +1100,7 @@
     pos = 0
     while state.actions:
         state.write()
-        actobj = state.actions.pop(0)
+        actobj = state.actions[0]
         pos += 1
         ui.progress(_("editing"), pos, actobj.torule(),
                     _('changes'), total)
@@ -1109,6 +1109,7 @@
         parentctx, replacement_ = actobj.run()
         state.parentctxnode = parentctx.node()
         state.replacements.extend(replacement_)
+        state.actions.pop(0)
     state.write()
     ui.progress(_("editing"), None)