##// END OF EJS Templates
histedit: remove now-superfluous repo argument from processreplacement...
Augie Fackler -
r22985:0c14b916 default
parent child Browse files
Show More
@@ -379,7 +379,6 b' def edit(ui, state, ha, opts):'
379 'When you are finished, run hg histedit --continue to resume.'))
379 'When you are finished, run hg histedit --continue to resume.'))
380
380
381 def rollup(ui, state, ha, opts):
381 def rollup(ui, state, ha, opts):
382 ctx = state.parentctx
383 rollupopts = opts.copy()
382 rollupopts = opts.copy()
384 rollupopts['rollup'] = True
383 rollupopts['rollup'] = True
385 return fold(ui, state, ha, rollupopts)
384 return fold(ui, state, ha, rollupopts)
@@ -600,7 +599,7 b' def _histedit(ui, repo, state, *freeargs'
600 elif goal == 'abort':
599 elif goal == 'abort':
601 state = histeditstate(repo)
600 state = histeditstate(repo)
602 state.read()
601 state.read()
603 mapping, tmpnodes, leafs, _ntm = processreplacement(repo, state)
602 mapping, tmpnodes, leafs, _ntm = processreplacement(state)
604 ui.debug('restore wc to old parent %s\n' % node.short(state.topmost))
603 ui.debug('restore wc to old parent %s\n' % node.short(state.topmost))
605 # check whether we should update away
604 # check whether we should update away
606 parentnodes = [c.node() for c in repo[None].parents()]
605 parentnodes = [c.node() for c in repo[None].parents()]
@@ -678,7 +677,7 b' def _histedit(ui, repo, state, *freeargs'
678
677
679 hg.update(repo, state.parentctx.node())
678 hg.update(repo, state.parentctx.node())
680
679
681 mapping, tmpnodes, created, ntm = processreplacement(repo, state)
680 mapping, tmpnodes, created, ntm = processreplacement(state)
682 if mapping:
681 if mapping:
683 for prec, succs in mapping.iteritems():
682 for prec, succs in mapping.iteritems():
684 if not succs:
683 if not succs:
@@ -854,7 +853,7 b' def verifyrules(rules, repo, ctxs):'
854 hint=_('do you want to use the drop action?'))
853 hint=_('do you want to use the drop action?'))
855 return parsed
854 return parsed
856
855
857 def processreplacement(repo, state):
856 def processreplacement(state):
858 """process the list of replacements to return
857 """process the list of replacements to return
859
858
860 1) the final mapping between original and created nodes
859 1) the final mapping between original and created nodes
@@ -897,20 +896,21 b' def processreplacement(repo, state):'
897 del final[n]
896 del final[n]
898 # we expect all changes involved in final to exist in the repo
897 # we expect all changes involved in final to exist in the repo
899 # turn `final` into list (topologically sorted)
898 # turn `final` into list (topologically sorted)
900 nm = repo.changelog.nodemap
899 nm = state.repo.changelog.nodemap
901 for prec, succs in final.items():
900 for prec, succs in final.items():
902 final[prec] = sorted(succs, key=nm.get)
901 final[prec] = sorted(succs, key=nm.get)
903
902
904 # computed topmost element (necessary for bookmark)
903 # computed topmost element (necessary for bookmark)
905 if new:
904 if new:
906 newtopmost = sorted(new, key=repo.changelog.rev)[-1]
905 newtopmost = sorted(new, key=state.repo.changelog.rev)[-1]
907 elif not final:
906 elif not final:
908 # Nothing rewritten at all. we won't need `newtopmost`
907 # Nothing rewritten at all. we won't need `newtopmost`
909 # It is the same as `oldtopmost` and `processreplacement` know it
908 # It is the same as `oldtopmost` and `processreplacement` know it
910 newtopmost = None
909 newtopmost = None
911 else:
910 else:
912 # every body died. The newtopmost is the parent of the root.
911 # every body died. The newtopmost is the parent of the root.
913 newtopmost = repo[sorted(final, key=repo.changelog.rev)[0]].p1().node()
912 r = state.repo.changelog.rev
913 newtopmost = state.repo[sorted(final, key=r)[0]].p1().node()
914
914
915 return final, tmpnodes, new, newtopmost
915 return final, tmpnodes, new, newtopmost
916
916
General Comments 0
You need to be logged in to leave comments. Login now