##// END OF EJS Templates
histedit: fix new nodes computation with --continue (issue3534)...
Patrick Mezard -
r17242:33612108 stable
parent child Browse files
Show More
@@ -430,19 +430,26 b' def histedit(ui, repo, *parent, **opts):'
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:
438 if action in ('f', 'fold'):
448 if action in ('f', 'fold'):
439 tmpnodes.extend([n.node() for n in newchildren])
449 tmpnodes.extend(newchildren)
440 else:
450 else:
441 created.extend([n.node() for n in newchildren])
451 created.extend(newchildren)
442 filtered = []
452
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()
@@ -183,3 +183,56 b' should effectively drop the changes from'
183
183
184
184
185 $ cd ..
185 $ cd ..
186
187 Test corner case where folded revision is separated from its parent by a
188 dropped revision.
189
190
191 $ hg init fold-with-dropped
192 $ cd fold-with-dropped
193 $ printf "1\n2\n3\n" > file
194 $ hg commit -Am '1+2+3'
195 adding file
196 $ echo 4 >> file
197 $ hg commit -m '+4'
198 $ echo 5 >> file
199 $ hg commit -m '+5'
200 $ echo 6 >> file
201 $ hg commit -m '+6'
202 $ hg log -G --template '{rev}:{node|short} {desc|firstline}\n'
203 @ 3:251d831eeec5 +6
204 |
205 o 2:888f9082bf99 +5
206 |
207 o 1:617f94f13c0f +4
208 |
209 o 0:0189ba417d34 1+2+3
210
211 $ EDITED=`pwd`/../editcommands
212 $ cat > $EDITED <<EOF
213 > pick 617f94f13c0f 1 +4
214 > drop 888f9082bf99 2 +5
215 > fold 251d831eeec5 3 +6
216 > EOF
217 $ HGEDITOR="cat $EDITED >" hg histedit 1
218 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
219 patching file file
220 Hunk #1 FAILED at 2
221 1 out of 1 hunks FAILED -- saving rejects to file file.rej
222 abort: Fix up the change and run hg histedit --continue
223 [255]
224 $ echo 5 >> file
225 $ hg commit -m '+5.2'
226 created new head
227 $ echo 6 >> file
228 $ HGEDITOR=cat hg histedit --continue
229 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
230 +4
231 ***
232 +5.2
233 ***
234 +6
235 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
236 saved backup bundle to $TESTTMP/fold-with-dropped/.hg/strip-backup/617f94f13c0f-backup.hg (glob)
237 $ cd ..
238
General Comments 0
You need to be logged in to leave comments. Login now