comparison hgext/histedit.py @ 20648:0838bd2f600f

histedit: move logic for finding child nodes to new function This function will be used in later patches.
author Olle Lundberg <geek@nerd.sh>
date Thu, 06 Mar 2014 01:24:03 +0100
parents 70d02abff434
children efbf15979538
comparison
equal deleted inserted replaced
20647:70d02abff434 20648:0838bd2f600f
644 cleanupnode(ui, repo, 'temp', tmpnodes) 644 cleanupnode(ui, repo, 'temp', tmpnodes)
645 os.unlink(os.path.join(repo.path, 'histedit-state')) 645 os.unlink(os.path.join(repo.path, 'histedit-state'))
646 if os.path.exists(repo.sjoin('undo')): 646 if os.path.exists(repo.sjoin('undo')):
647 os.unlink(repo.sjoin('undo')) 647 os.unlink(repo.sjoin('undo'))
648 648
649 649 def gatherchildren(repo, ctx):
650 def bootstrapcontinue(ui, repo, parentctx, rules, opts):
651 action, currentnode = rules.pop(0)
652 ctx = repo[currentnode]
653 # is there any new commit between the expected parent and "." 650 # is there any new commit between the expected parent and "."
654 # 651 #
655 # note: does not take non linear new change in account (but previous 652 # note: does not take non linear new change in account (but previous
656 # implementation didn't used them anyway (issue3655) 653 # implementation didn't used them anyway (issue3655)
657 newchildren = [c.node() for c in repo.set('(%d::.)', parentctx)] 654 newchildren = [c.node() for c in repo.set('(%d::.)', ctx)]
658 if parentctx.node() != node.nullid: 655 if ctx.node() != node.nullid:
659 if not newchildren: 656 if not newchildren:
660 # `parentctxnode` should match but no result. This means that 657 # `ctx` should match but no result. This means that
661 # currentnode is not a descendant from parentctxnode. 658 # currentnode is not a descendant from ctx.
662 msg = _('%s is not an ancestor of working directory') 659 msg = _('%s is not an ancestor of working directory')
663 hint = _('use "histedit --abort" to clear broken state') 660 hint = _('use "histedit --abort" to clear broken state')
664 raise util.Abort(msg % parentctx, hint=hint) 661 raise util.Abort(msg % ctx, hint=hint)
665 newchildren.pop(0) # remove parentctxnode 662 newchildren.pop(0) # remove ctx
663 return newchildren
664
665 def bootstrapcontinue(ui, repo, parentctx, rules, opts):
666 action, currentnode = rules.pop(0)
667 ctx = repo[currentnode]
668
669 newchildren = gatherchildren(repo, parentctx)
670
666 # Commit dirty working directory if necessary 671 # Commit dirty working directory if necessary
667 new = None 672 new = None
668 m, a, r, d = repo.status()[:4] 673 m, a, r, d = repo.status()[:4]
669 if m or a or r or d: 674 if m or a or r or d:
670 # prepare the message for the commit to comes 675 # prepare the message for the commit to comes