Show More
@@ -190,13 +190,13 b' editcomment = _("""# Edit history betwee' | |||||
190 | """) |
|
190 | """) | |
191 |
|
191 | |||
192 | class histeditstate(object): |
|
192 | class histeditstate(object): | |
193 | def __init__(self, repo, parentctx=None, rules=None, keep=None, |
|
193 | def __init__(self, repo, parentctxnode=None, rules=None, keep=None, | |
194 | topmost=None, replacements=None, lock=None, wlock=None): |
|
194 | topmost=None, replacements=None, lock=None, wlock=None): | |
195 | self.repo = repo |
|
195 | self.repo = repo | |
196 | self.rules = rules |
|
196 | self.rules = rules | |
197 | self.keep = keep |
|
197 | self.keep = keep | |
198 | self.topmost = topmost |
|
198 | self.topmost = topmost | |
199 | self.parentctx = parentctx |
|
199 | self.parentctxnode = parentctxnode | |
200 | self.lock = lock |
|
200 | self.lock = lock | |
201 | self.wlock = wlock |
|
201 | self.wlock = wlock | |
202 | if replacements is None: |
|
202 | if replacements is None: | |
@@ -215,7 +215,7 b' class histeditstate(object):' | |||||
215 |
|
215 | |||
216 | parentctxnode, rules, keep, topmost, replacements = pickle.load(fp) |
|
216 | parentctxnode, rules, keep, topmost, replacements = pickle.load(fp) | |
217 |
|
217 | |||
218 |
self.parentctx = |
|
218 | self.parentctxnode = parentctxnode | |
219 | self.rules = rules |
|
219 | self.rules = rules | |
220 | self.keep = keep |
|
220 | self.keep = keep | |
221 | self.topmost = topmost |
|
221 | self.topmost = topmost | |
@@ -223,7 +223,7 b' class histeditstate(object):' | |||||
223 |
|
223 | |||
224 | def write(self): |
|
224 | def write(self): | |
225 | fp = self.repo.vfs('histedit-state', 'w') |
|
225 | fp = self.repo.vfs('histedit-state', 'w') | |
226 |
pickle.dump((self.parentctx |
|
226 | pickle.dump((self.parentctxnode, self.rules, self.keep, | |
227 | self.topmost, self.replacements), fp) |
|
227 | self.topmost, self.replacements), fp) | |
228 | fp.close() |
|
228 | fp.close() | |
229 |
|
229 | |||
@@ -347,7 +347,8 b' def collapse(repo, first, last, commitop' | |||||
347 | return repo.commitctx(new) |
|
347 | return repo.commitctx(new) | |
348 |
|
348 | |||
349 | def pick(ui, state, ha, opts): |
|
349 | def pick(ui, state, ha, opts): | |
350 | repo, ctx = state.repo, state.parentctx |
|
350 | repo, ctxnode = state.repo, state.parentctxnode | |
|
351 | ctx = repo[ctxnode] | |||
351 | oldctx = repo[ha] |
|
352 | oldctx = repo[ha] | |
352 | if oldctx.parents()[0] == ctx: |
|
353 | if oldctx.parents()[0] == ctx: | |
353 | ui.debug('node %s unchanged\n' % ha[:12]) |
|
354 | ui.debug('node %s unchanged\n' % ha[:12]) | |
@@ -369,7 +370,8 b' def pick(ui, state, ha, opts):' | |||||
369 |
|
370 | |||
370 |
|
371 | |||
371 | def edit(ui, state, ha, opts): |
|
372 | def edit(ui, state, ha, opts): | |
372 | repo, ctx = state.repo, state.parentctx |
|
373 | repo, ctxnode = state.repo, state.parentctxnode | |
|
374 | ctx = repo[ctxnode] | |||
373 | oldctx = repo[ha] |
|
375 | oldctx = repo[ha] | |
374 | hg.update(repo, ctx.node()) |
|
376 | hg.update(repo, ctx.node()) | |
375 | applychanges(ui, repo, oldctx, opts) |
|
377 | applychanges(ui, repo, oldctx, opts) | |
@@ -383,7 +385,8 b' def rollup(ui, state, ha, opts):' | |||||
383 | return fold(ui, state, ha, rollupopts) |
|
385 | return fold(ui, state, ha, rollupopts) | |
384 |
|
386 | |||
385 | def fold(ui, state, ha, opts): |
|
387 | def fold(ui, state, ha, opts): | |
386 | repo, ctx = state.repo, state.parentctx |
|
388 | repo, ctxnode = state.repo, state.parentctxnode | |
|
389 | ctx = repo[ctxnode] | |||
387 | oldctx = repo[ha] |
|
390 | oldctx = repo[ha] | |
388 | hg.update(repo, ctx.node()) |
|
391 | hg.update(repo, ctx.node()) | |
389 | stats = applychanges(ui, repo, oldctx, opts) |
|
392 | stats = applychanges(ui, repo, oldctx, opts) | |
@@ -439,12 +442,14 b' def finishfold(ui, repo, ctx, oldctx, ne' | |||||
439 | return repo[n], replacements |
|
442 | return repo[n], replacements | |
440 |
|
443 | |||
441 | def drop(ui, state, ha, opts): |
|
444 | def drop(ui, state, ha, opts): | |
442 | repo, ctx = state.repo, state.parentctx |
|
445 | repo, ctxnode = state.repo, state.parentctxnode | |
|
446 | ctx = repo[ctxnode] | |||
443 | return ctx, [(repo[ha].node(), ())] |
|
447 | return ctx, [(repo[ha].node(), ())] | |
444 |
|
448 | |||
445 |
|
449 | |||
446 | def message(ui, state, ha, opts): |
|
450 | def message(ui, state, ha, opts): | |
447 | repo, ctx = state.repo, state.parentctx |
|
451 | repo, ctxnode = state.repo, state.parentctxnode | |
|
452 | ctx = repo[ctxnode] | |||
448 | oldctx = repo[ha] |
|
453 | oldctx = repo[ha] | |
449 | hg.update(repo, ctx.node()) |
|
454 | hg.update(repo, ctx.node()) | |
450 | stats = applychanges(ui, repo, oldctx, opts) |
|
455 | stats = applychanges(ui, repo, oldctx, opts) | |
@@ -604,7 +609,7 b' def _histedit(ui, repo, state, *freeargs' | |||||
604 | ui.debug('restore wc to old parent %s\n' % node.short(state.topmost)) |
|
609 | ui.debug('restore wc to old parent %s\n' % node.short(state.topmost)) | |
605 | # check whether we should update away |
|
610 | # check whether we should update away | |
606 | parentnodes = [c.node() for c in repo[None].parents()] |
|
611 | parentnodes = [c.node() for c in repo[None].parents()] | |
607 |
for n in leafs | set([state.parentctx |
|
612 | for n in leafs | set([state.parentctxnode]): | |
608 | if n in parentnodes: |
|
613 | if n in parentnodes: | |
609 | hg.clean(repo, state.topmost) |
|
614 | hg.clean(repo, state.topmost) | |
610 | break |
|
615 | break | |
@@ -660,9 +665,9 b' def _histedit(ui, repo, state, *freeargs' | |||||
660 | if l and not l.startswith('#')] |
|
665 | if l and not l.startswith('#')] | |
661 | rules = verifyrules(rules, repo, ctxs) |
|
666 | rules = verifyrules(rules, repo, ctxs) | |
662 |
|
667 | |||
663 | parentctx = repo[root].parents()[0] |
|
668 | parentctxnode = repo[root].parents()[0].node() | |
664 |
|
669 | |||
665 | state.parentctx = parentctx |
|
670 | state.parentctxnode = parentctxnode | |
666 | state.rules = rules |
|
671 | state.rules = rules | |
667 | state.keep = keep |
|
672 | state.keep = keep | |
668 | state.topmost = topmost |
|
673 | state.topmost = topmost | |
@@ -673,11 +678,12 b' def _histedit(ui, repo, state, *freeargs' | |||||
673 | action, ha = state.rules.pop(0) |
|
678 | action, ha = state.rules.pop(0) | |
674 | ui.debug('histedit: processing %s %s\n' % (action, ha[:12])) |
|
679 | ui.debug('histedit: processing %s %s\n' % (action, ha[:12])) | |
675 | actfunc = actiontable[action] |
|
680 | actfunc = actiontable[action] | |
676 |
|
|
681 | parentctx, replacement_ = actfunc(ui, state, ha, opts) | |
|
682 | state.parentctxnode = parentctx.node() | |||
677 | state.replacements.extend(replacement_) |
|
683 | state.replacements.extend(replacement_) | |
678 | state.write() |
|
684 | state.write() | |
679 |
|
685 | |||
680 |
hg.update(repo, state.parentctx |
|
686 | hg.update(repo, state.parentctxnode) | |
681 |
|
687 | |||
682 | mapping, tmpnodes, created, ntm = processreplacement(state) |
|
688 | mapping, tmpnodes, created, ntm = processreplacement(state) | |
683 | if mapping: |
|
689 | if mapping: | |
@@ -730,7 +736,8 b' def gatherchildren(repo, ctx):' | |||||
730 | return newchildren |
|
736 | return newchildren | |
731 |
|
737 | |||
732 | def bootstrapcontinue(ui, state, opts): |
|
738 | def bootstrapcontinue(ui, state, opts): | |
733 | repo, parentctx = state.repo, state.parentctx |
|
739 | repo, parentctxnode = state.repo, state.parentctxnode | |
|
740 | parentctx = repo[parentctxnode] | |||
734 | action, currentnode = state.rules.pop(0) |
|
741 | action, currentnode = state.rules.pop(0) | |
735 | ctx = repo[currentnode] |
|
742 | ctx = repo[currentnode] | |
736 |
|
743 | |||
@@ -786,7 +793,7 b' def bootstrapcontinue(ui, state, opts):' | |||||
786 | # otherwise update "parentctx" before proceeding to further operation |
|
793 | # otherwise update "parentctx" before proceeding to further operation | |
787 | parentctx = repo[newchildren[-1]] |
|
794 | parentctx = repo[newchildren[-1]] | |
788 |
|
795 | |||
789 | state.parentctx = parentctx |
|
796 | state.parentctxnode = parentctx.node() | |
790 | state.replacements.extend(replacements) |
|
797 | state.replacements.extend(replacements) | |
791 |
|
798 | |||
792 | return state |
|
799 | return state |
General Comments 0
You need to be logged in to leave comments.
Login now