Mercurial > hg
comparison hgext/histedit.py @ 17242:336121088ef1 stable
histedit: fix new nodes computation with --continue (issue3534)
When running the following actions:
pick 617f94f13c0f 1 +4
drop 888f9082bf99 2 +5
fold 251d831eeec5 3 +6
if the fold fails, is fixed by the user with a new changeset, --continue
will ignore the new revision when generating the fold changelog. This
was caused by --continue detecting new changesets as descendants of the
parent not descendants of changesets in the initial list. In this case,
dropped changesets must be ignored.
Even with the computation fixed, the 'newchildren' list was always
emptied by the filtering loop and passed empty to finishfold().
Note that changesets dropped and recreated identically will still be
missed. This probably cannot be solved but is unlikely to happen.
Other things, like 'newchildren' having multiple heads, should be
checked as well.
author | Patrick Mezard <patrick@mezard.eu> |
---|---|
date | Wed, 25 Jul 2012 16:27:26 +0200 |
parents | c2f13180001f |
children | 8c3951e233f4 |
comparison
equal
deleted
inserted
replaced
17241:c2f13180001f | 17242:336121088ef1 |
---|---|
428 raise util.Abort(_('no arguments allowed with --continue')) | 428 raise util.Abort(_('no arguments allowed with --continue')) |
429 (parentctxnode, created, replaced, | 429 (parentctxnode, created, replaced, |
430 tmpnodes, existing, rules, keep, tip, replacemap) = readstate(repo) | 430 tmpnodes, existing, rules, keep, tip, replacemap) = readstate(repo) |
431 currentparent, wantnull = repo.dirstate.parents() | 431 currentparent, wantnull = repo.dirstate.parents() |
432 parentctx = repo[parentctxnode] | 432 parentctx = repo[parentctxnode] |
433 # discover any nodes the user has added in the interim | 433 # existing is the list of revisions initially considered by |
434 newchildren = [c for c in parentctx.children() | 434 # histedit. Here we use it to list new changesets, descendants |
435 if c.node() not in existing] | 435 # of parentctx without an 'existing' changeset in-between. We |
436 # also have to exclude 'existing' changesets which were | |
437 # previously dropped. | |
438 descendants = set(c.node() for c in | |
439 repo.set('(%n::) - %n', parentctxnode, parentctxnode)) | |
440 existing = set(existing) | |
441 notdropped = set(n for n in existing if n in descendants and | |
442 (n not in replacemap or replacemap[n] in descendants)) | |
443 # Discover any nodes the user has added in the interim. We can | |
444 # miss changesets which were dropped and recreated the same. | |
445 newchildren = list(c.node() for c in repo.set( | |
446 'sort(%ln - (%ln or %ln::))', descendants, existing, notdropped)) | |
436 action, currentnode = rules.pop(0) | 447 action, currentnode = rules.pop(0) |
437 while newchildren: | 448 if action in ('f', 'fold'): |
438 if action in ('f', 'fold'): | 449 tmpnodes.extend(newchildren) |
439 tmpnodes.extend([n.node() for n in newchildren]) | 450 else: |
440 else: | 451 created.extend(newchildren) |
441 created.extend([n.node() for n in newchildren]) | 452 |
442 filtered = [] | |
443 for r in newchildren: | |
444 filtered += [c for c in r.children() if c.node not in existing] | |
445 newchildren = filtered | |
446 m, a, r, d = repo.status()[:4] | 453 m, a, r, d = repo.status()[:4] |
447 oldctx = repo[currentnode] | 454 oldctx = repo[currentnode] |
448 message = oldctx.description() | 455 message = oldctx.description() |
449 if action in ('e', 'edit', 'm', 'mess'): | 456 if action in ('e', 'edit', 'm', 'mess'): |
450 message = ui.edit(message, ui.username()) | 457 message = ui.edit(message, ui.username()) |