Patchwork [5,of,9] histedit: pass state to boostrapcontinue

login
register
mail settings
Submitter David Soria Parra
Date Oct. 16, 2014, 5:34 p.m.
Message ID <cbe0c2c08822ca9a3646.1413480881@davidsp-mbp.dhcp.thefacebook.com>
Download mbox | patch
Permalink /patch/6343/
State Accepted
Headers show

Comments

David Soria Parra - Oct. 16, 2014, 5:34 p.m.
# HG changeset patch
# User David Soria Parra <davidsp@fb.com>
# Date 1413385575 25200
#      Wed Oct 15 08:06:15 2014 -0700
# Node ID cbe0c2c08822ca9a36463c385601ecd9a5bb53e2
# Parent  4e8e8f316476d1ab7bf0f9feed6f11d4bae12f59
histedit: pass state to boostrapcontinue

Pass the state to boostrapcontinue and remove the unecessary passing
of repo.

Patch

diff --git a/hgext/histedit.py b/hgext/histedit.py
--- a/hgext/histedit.py
+++ b/hgext/histedit.py
@@ -569,9 +569,7 @@ 
     # rebuild state
     if goal == 'continue':
         state = readstate(repo)
-        state.parentctx, repl = bootstrapcontinue(ui, repo, state.parentctx,
-                state.rules, opts)
-        state.replacements.extend(repl)
+        state = bootstrapcontinue(ui, state, opts)
     elif goal == 'abort':
         state = readstate(repo)
         mapping, tmpnodes, leafs, _ntm = processreplacement(repo,
@@ -702,8 +700,9 @@ 
         newchildren.pop(0)  # remove ctx
     return newchildren
 
-def bootstrapcontinue(ui, repo, parentctx, rules, opts):
-    action, currentnode = rules.pop(0)
+def bootstrapcontinue(ui, state, opts):
+    repo, parentctx = state.repo, state.parentctx
+    action, currentnode = state.rules.pop(0)
     ctx = repo[currentnode]
 
     newchildren = gatherchildren(repo, parentctx)
@@ -758,8 +757,11 @@ 
     elif newchildren:
         # otherwise update "parentctx" before proceeding to further operation
         parentctx = repo[newchildren[-1]]
-    return parentctx, replacements
 
+    state.parentctx = parentctx
+    state.replacements.extend(replacements)
+
+    return state
 
 def between(repo, old, new, keep):
     """select and validate the set of revision to edit