comparison hgext/histedit.py @ 17749:40601f2b7608

histedit: simplify computation of `newchildren` during --continue We are now checking for any changesets between the previous `parentctx` and the current working directory parent. If the current working directory parent is inconsistent, we abort. This change is useful as it simplifies the --continue process, easing upcoming changes. While working on this changeset, I spotted an unhandled corner case. This corner case is now documented and have an appropriate issue in the tracker (issue3655). However, the corner case is still unhandled. handling this test case would required some additional work: - actually decide what the proper behavior should be: - change content of "histedit-state" to add missing data necessary to detect the situation - add proper testcase, But leaving the case unhandled is "okay": - this is not a regression, - this is not the purpose of the current series, - the freeze was near and I had more critical stuff to attend to, - this is a simple but non trivial, (see above)
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
date Wed, 10 Oct 2012 06:20:14 +0200
parents 5b6c8f2fbda5
children bb6149f1db83
comparison
equal deleted inserted replaced
17748:49f759636aaf 17749:40601f2b7608
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