histedit: remove now-superfluous repo argument from processreplacement
authorAugie Fackler <raf@durin42.com>
Thu, 16 Oct 2014 14:49:46 -0400
changeset 22985 0c14b9166da6
parent 22984 e0b5f5e3afe8
child 22986 7b93b49286d0
histedit: remove now-superfluous repo argument from processreplacement Spotted by Olle on the mailing list during review.
hgext/histedit.py
--- a/hgext/histedit.py	Wed Oct 15 08:38:36 2014 -0700
+++ b/hgext/histedit.py	Thu Oct 16 14:49:46 2014 -0400
@@ -379,7 +379,6 @@
           'When you are finished, run hg histedit --continue to resume.'))
 
 def rollup(ui, state, ha, opts):
-    ctx = state.parentctx
     rollupopts = opts.copy()
     rollupopts['rollup'] = True
     return fold(ui, state, ha, rollupopts)
@@ -600,7 +599,7 @@
     elif goal == 'abort':
         state = histeditstate(repo)
         state.read()
-        mapping, tmpnodes, leafs, _ntm = processreplacement(repo, state)
+        mapping, tmpnodes, leafs, _ntm = processreplacement(state)
         ui.debug('restore wc to old parent %s\n' % node.short(state.topmost))
         # check whether we should update away
         parentnodes = [c.node() for c in repo[None].parents()]
@@ -678,7 +677,7 @@
 
     hg.update(repo, state.parentctx.node())
 
-    mapping, tmpnodes, created, ntm = processreplacement(repo, state)
+    mapping, tmpnodes, created, ntm = processreplacement(state)
     if mapping:
         for prec, succs in mapping.iteritems():
             if not succs:
@@ -854,7 +853,7 @@
                          hint=_('do you want to use the drop action?'))
     return parsed
 
-def processreplacement(repo, state):
+def processreplacement(state):
     """process the list of replacements to return
 
     1) the final mapping between original and created nodes
@@ -897,20 +896,21 @@
         del final[n]
     # we expect all changes involved in final to exist in the repo
     # turn `final` into list (topologically sorted)
-    nm = repo.changelog.nodemap
+    nm = state.repo.changelog.nodemap
     for prec, succs in final.items():
         final[prec] = sorted(succs, key=nm.get)
 
     # computed topmost element (necessary for bookmark)
     if new:
-        newtopmost = sorted(new, key=repo.changelog.rev)[-1]
+        newtopmost = sorted(new, key=state.repo.changelog.rev)[-1]
     elif not final:
         # Nothing rewritten at all. we won't need `newtopmost`
         # It is the same as `oldtopmost` and `processreplacement` know it
         newtopmost = None
     else:
         # every body died. The newtopmost is the parent of the root.
-        newtopmost = repo[sorted(final, key=repo.changelog.rev)[0]].p1().node()
+        r = state.repo.changelog.rev
+        newtopmost = state.repo[sorted(final, key=r)[0]].p1().node()
 
     return final, tmpnodes, new, newtopmost