Show More
@@ -417,8 +417,8 b' def histedit(ui, repo, *parent, **opts):' | |||||
417 | if opts.get('continue', False): |
|
417 | if opts.get('continue', False): | |
418 | if len(parent) != 0: |
|
418 | if len(parent) != 0: | |
419 | raise util.Abort(_('no arguments allowed with --continue')) |
|
419 | raise util.Abort(_('no arguments allowed with --continue')) | |
420 | (parentctxnode, created, replaced, |
|
420 | (parentctxnode, created, replaced, tmpnodes, | |
421 |
|
|
421 | existing, rules, keep, topmost, replacemap) = readstate(repo) | |
422 | currentparent, wantnull = repo.dirstate.parents() |
|
422 | currentparent, wantnull = repo.dirstate.parents() | |
423 | parentctx = repo[parentctxnode] |
|
423 | parentctx = repo[parentctxnode] | |
424 | # existing is the list of revisions initially considered by |
|
424 | # existing is the list of revisions initially considered by | |
@@ -479,9 +479,9 b' def histedit(ui, repo, *parent, **opts):' | |||||
479 | if len(parent) != 0: |
|
479 | if len(parent) != 0: | |
480 | raise util.Abort(_('no arguments allowed with --abort')) |
|
480 | raise util.Abort(_('no arguments allowed with --abort')) | |
481 | (parentctxnode, created, replaced, tmpnodes, |
|
481 | (parentctxnode, created, replaced, tmpnodes, | |
482 |
existing, rules, keep, t |
|
482 | existing, rules, keep, topmost, replacemap) = readstate(repo) | |
483 |
ui.debug('restore wc to old t |
|
483 | ui.debug('restore wc to old parent %s\n' % node.short(topmost)) | |
484 |
hg.clean(repo, t |
|
484 | hg.clean(repo, topmost) | |
485 | cleanupnode(ui, repo, 'created', created) |
|
485 | cleanupnode(ui, repo, 'created', created) | |
486 | cleanupnode(ui, repo, 'temp', tmpnodes) |
|
486 | cleanupnode(ui, repo, 'temp', tmpnodes) | |
487 | os.unlink(os.path.join(repo.path, 'histedit-state')) |
|
487 | os.unlink(os.path.join(repo.path, 'histedit-state')) | |
@@ -492,7 +492,7 b' def histedit(ui, repo, *parent, **opts):' | |||||
492 | raise util.Abort(_('history edit already in progress, try ' |
|
492 | raise util.Abort(_('history edit already in progress, try ' | |
493 | '--continue or --abort')) |
|
493 | '--continue or --abort')) | |
494 |
|
494 | |||
495 |
t |
|
495 | topmost, empty = repo.dirstate.parents() | |
496 |
|
496 | |||
497 |
|
497 | |||
498 | if len(parent) != 1: |
|
498 | if len(parent) != 1: | |
@@ -500,7 +500,7 b' def histedit(ui, repo, *parent, **opts):' | |||||
500 | parent = scmutil.revsingle(repo, parent[0]).node() |
|
500 | parent = scmutil.revsingle(repo, parent[0]).node() | |
501 |
|
501 | |||
502 | keep = opts.get('keep', False) |
|
502 | keep = opts.get('keep', False) | |
503 |
revs = between(repo, parent, t |
|
503 | revs = between(repo, parent, topmost, keep) | |
504 |
|
504 | |||
505 | ctxs = [repo[r] for r in revs] |
|
505 | ctxs = [repo[r] for r in revs] | |
506 | existing = [r.node() for r in ctxs] |
|
506 | existing = [r.node() for r in ctxs] | |
@@ -508,7 +508,7 b' def histedit(ui, repo, *parent, **opts):' | |||||
508 | if not rules: |
|
508 | if not rules: | |
509 | rules = '\n'.join([makedesc(c) for c in ctxs]) |
|
509 | rules = '\n'.join([makedesc(c) for c in ctxs]) | |
510 | rules += '\n\n' |
|
510 | rules += '\n\n' | |
511 |
rules += editcomment % (node.short(parent), node.short(t |
|
511 | rules += editcomment % (node.short(parent), node.short(topmost)) | |
512 | rules = ui.edit(rules, ui.username()) |
|
512 | rules = ui.edit(rules, ui.username()) | |
513 | # Save edit rules in .hg/histedit-last-edit.txt in case |
|
513 | # Save edit rules in .hg/histedit-last-edit.txt in case | |
514 | # the user needs to ask for help after something |
|
514 | # the user needs to ask for help after something | |
@@ -534,7 +534,7 b' def histedit(ui, repo, *parent, **opts):' | |||||
534 |
|
534 | |||
535 | while rules: |
|
535 | while rules: | |
536 | writestate(repo, parentctx.node(), created, replaced, |
|
536 | writestate(repo, parentctx.node(), created, replaced, | |
537 |
tmpnodes, existing, rules, keep, t |
|
537 | tmpnodes, existing, rules, keep, topmost, replacemap) | |
538 | action, ha = rules.pop(0) |
|
538 | action, ha = rules.pop(0) | |
539 | ui.debug('histedit: processing %s %s\n' % (action, ha)) |
|
539 | ui.debug('histedit: processing %s %s\n' % (action, ha)) | |
540 | (parentctx, created_, replaced_, tmpnodes_) = actiontable[action]( |
|
540 | (parentctx, created_, replaced_, tmpnodes_) = actiontable[action]( | |
@@ -622,16 +622,16 b' def between(repo, old, new, keep):' | |||||
622 |
|
622 | |||
623 |
|
623 | |||
624 | def writestate(repo, parentctxnode, created, replaced, |
|
624 | def writestate(repo, parentctxnode, created, replaced, | |
625 |
tmpnodes, existing, rules, keep, |
|
625 | tmpnodes, existing, rules, keep, topmost, replacemap): | |
626 | fp = open(os.path.join(repo.path, 'histedit-state'), 'w') |
|
626 | fp = open(os.path.join(repo.path, 'histedit-state'), 'w') | |
627 | pickle.dump((parentctxnode, created, replaced, |
|
627 | pickle.dump((parentctxnode, created, replaced, | |
628 |
tmpnodes, existing, rules, keep, |
|
628 | tmpnodes, existing, rules, keep, topmost, replacemap), | |
629 | fp) |
|
629 | fp) | |
630 | fp.close() |
|
630 | fp.close() | |
631 |
|
631 | |||
632 | def readstate(repo): |
|
632 | def readstate(repo): | |
633 | """Returns a tuple of (parentnode, created, replaced, tmp, existing, rules, |
|
633 | """Returns a tuple of (parentnode, created, replaced, tmp, existing, rules, | |
634 |
keep, |
|
634 | keep, topmost, replacemap ). | |
635 | """ |
|
635 | """ | |
636 | fp = open(os.path.join(repo.path, 'histedit-state')) |
|
636 | fp = open(os.path.join(repo.path, 'histedit-state')) | |
637 | return pickle.load(fp) |
|
637 | return pickle.load(fp) |
General Comments 0
You need to be logged in to leave comments.
Login now