comparison hgext/histedit.py @ 17757:fec69c72e2b4

merge with durin42
author Matt Mackall <mpm@selenic.com>
date Fri, 12 Oct 2012 15:52:59 -0500
parents b8424c92ba2b bb6149f1db83
children 5863f0e4cd3a
comparison
equal deleted inserted replaced
17756:92980a8dfdfe 17757:fec69c72e2b4
548 os.unlink(repo.sjoin('undo')) 548 os.unlink(repo.sjoin('undo'))
549 549
550 550
551 def bootstrapcontinue(ui, repo, parentctx, existing, replacemap, rules, 551 def bootstrapcontinue(ui, repo, parentctx, existing, replacemap, rules,
552 tmpnodes, created, replaced, opts): 552 tmpnodes, created, replaced, opts):
553 currentparent, wantnull = repo.dirstate.parents()
554 # existing is the list of revisions initially considered by
555 # histedit. Here we use it to list new changesets, descendants
556 # of parentctx without an 'existing' changeset in-between. We
557 # also have to exclude 'existing' changesets which were
558 # previously dropped.
559 descendants = set(c.node() for c in
560 repo.set('(%d::) - %d', parentctx, parentctx))
561 notdropped = set(n for n in existing if n in descendants and
562 (n not in replacemap or replacemap[n] in descendants))
563 # Discover any nodes the user has added in the interim. We can
564 # miss changesets which were dropped and recreated the same.
565 newchildren = list(c.node() for c in repo.set(
566 'sort(%ln - (%ln or %ln::))', descendants, existing, notdropped))
567 action, currentnode = rules.pop(0) 553 action, currentnode = rules.pop(0)
554 # is there any new commit between the expected parent and "."
555 #
556 # note: does not take non linear new change in account (but previous
557 # implementation didn't used them anyway (issue3655)
558 newchildren = [c.node() for c in repo.set('(%d::.)', parentctx)]
559 if not newchildren:
560 # `parentctxnode` should match but no result. This means that
561 # currentnode is not a descendant from parentctxnode.
562 msg = _('working directory parent is not a descendant of %s')
563 hint = _('update to %s or descendant and run "hg histedit '
564 '--continue" again') % parentctx
565 raise util.Abort(msg % parentctx, hint=hint)
566 newchildren.pop(0) # remove parentctxnode
568 if action in ('f', 'fold'): 567 if action in ('f', 'fold'):
569 tmpnodes.extend(newchildren) 568 tmpnodes.extend(newchildren)
570 else: 569 else:
571 created.extend(newchildren) 570 created.extend(newchildren)
572 571
694 if old in tmpnodes or old in created: 693 if old in tmpnodes or old in created:
695 # can't have any metadata we'd want to update 694 # can't have any metadata we'd want to update
696 return 695 return
697 while new in replacemap: 696 while new in replacemap:
698 new = replacemap[new] 697 new = replacemap[new]
699 ui.note(_('histedit: %s to %s\n') % (node.short(old),
700 node.short(new)))
701 octx = repo[old] 698 octx = repo[old]
702 marks = octx.bookmarks() 699 marks = octx.bookmarks()
703 if marks: 700 if marks:
704 ui.note(_('histedit: moving bookmarks %s\n') %
705 ', '.join(marks))
706 for mark in marks: 701 for mark in marks:
702 ui.note(_('histedit: moving bookmarks %s from %s to %s\n')
703 % (mark, octx, node.short(new)))
707 repo._bookmarks[mark] = new 704 repo._bookmarks[mark] = new
708 bookmarks.write(repo) 705 bookmarks.write(repo)
709 706
710 # We assume that bookmarks on the tip should remain 707 # We assume that bookmarks on the tip should remain
711 # tipmost, but bookmarks on non-tip changesets should go 708 # tipmost, but bookmarks on non-tip changesets should go