##// END OF EJS Templates
histedit: simplify computation of `newchildren` during --continue...
Pierre-Yves David -
r17749:40601f2b default
parent child Browse files
Show More
@@ -550,21 +550,20 b' def histedit(ui, repo, *parent, **opts):'
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:
@@ -66,6 +66,19 b' edit the history'
66 abort: Make changes as needed, you may commit or record as needed now.
66 abort: Make changes as needed, you may commit or record as needed now.
67 When you are finished, run hg histedit --continue to resume.
67 When you are finished, run hg histedit --continue to resume.
68
68
69 Go at a random point and try to continue
70
71 $ hg id -n
72 3+
73 $ hg up 0
74 0 files updated, 0 files merged, 3 files removed, 0 files unresolved
75 $ HGEDITOR='echo foobaz > ' hg histedit --continue
76 abort: working directory parent is not a descendant of 055a42cdd887
77 (update to 055a42cdd887 or descendant and run "hg histedit --continue" again)
78 [255]
79 $ hg up 3
80 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
81
69 commit, then edit the revision
82 commit, then edit the revision
70 $ hg ci -m 'wat'
83 $ hg ci -m 'wat'
71 created new head
84 created new head
General Comments 0
You need to be logged in to leave comments. Login now