##// END OF EJS Templates
rebase: update working directory when aborting (issue5084)
timeless -
r27988:61f4d59e stable
parent child Browse files
Show More
@@ -0,0 +1,18 b''
1 # extension to emulate interupting filemerge._filemerge
2
3 from __future__ import absolute_import
4
5 from mercurial import (
6 filemerge,
7 extensions,
8 error,
9 )
10
11 def failfilemerge(filemergefn,
12 premerge, repo, mynode, orig, fcd, fco, fca, labels=None):
13 raise error.Abort("^C")
14 return filemergefn(premerge, repo, mynode, orig, fcd, fco, fca, labels)
15
16 def extsetup(ui):
17 extensions.wrapfunction(filemerge, '_filemerge',
18 failfilemerge)
@@ -975,15 +975,20 b' def abort(repo, originalwd, target, stat'
975 cleanup = False
975 cleanup = False
976
976
977 if cleanup:
977 if cleanup:
978 shouldupdate = False
979 rebased = filter(lambda x: x >= 0 and x != target, state.values())
980 if rebased:
981 strippoints = [
982 c.node() for c in repo.set('roots(%ld)', rebased)]
983 shouldupdate = len([
984 c.node() for c in repo.set('. & (%ld)', rebased)]) > 0
985
978 # Update away from the rebase if necessary
986 # Update away from the rebase if necessary
979 if needupdate(repo, state):
987 if shouldupdate or needupdate(repo, state):
980 merge.update(repo, originalwd, False, True)
988 merge.update(repo, originalwd, False, True)
981
989
982 # Strip from the first rebased revision
990 # Strip from the first rebased revision
983 rebased = filter(lambda x: x >= 0 and x != target, state.values())
984 if rebased:
991 if rebased:
985 strippoints = [
986 c.node() for c in repo.set('roots(%ld)', rebased)]
987 # no backup of rebased cset versions needed
992 # no backup of rebased cset versions needed
988 repair.strip(repo.ui, repo, strippoints)
993 repair.strip(repo.ui, repo, strippoints)
989
994
@@ -323,6 +323,78 b' user has somehow managed to update to a '
323
323
324 $ cd ..
324 $ cd ..
325
325
326 test aborting an interrupted series (issue5084)
327 $ hg init interrupted
328 $ cd interrupted
329 $ touch base
330 $ hg add base
331 $ hg commit -m base
332 $ touch a
333 $ hg add a
334 $ hg commit -m a
335 $ echo 1 > a
336 $ hg commit -m 1
337 $ touch b
338 $ hg add b
339 $ hg commit -m b
340 $ echo 2 >> a
341 $ hg commit -m c
342 $ touch d
343 $ hg add d
344 $ hg commit -m d
345 $ hg co -q 1
346 $ hg rm a
347 $ hg commit -m no-a
348 created new head
349 $ hg co 0
350 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
351 $ hg log -G --template "{rev} {desc} {bookmarks}"
352 o 6 no-a
353 |
354 | o 5 d
355 | |
356 | o 4 c
357 | |
358 | o 3 b
359 | |
360 | o 2 1
361 |/
362 o 1 a
363 |
364 @ 0 base
365
366 $ hg --config extensions.n=$TESTDIR/failfilemerge.py rebase -s 3 -d tip
367 rebasing 3:3a71550954f1 "b"
368 rebasing 4:e80b69427d80 "c"
369 abort: ^C
370 [255]
371 $ hg rebase --abort
372 saved backup bundle to $TESTTMP/interrupted/.hg/strip-backup/3d8812cf300d-93041a90-backup.hg (glob)
373 rebase aborted
374 $ hg log -G --template "{rev} {desc} {bookmarks}"
375 o 6 no-a
376 |
377 | o 5 d
378 | |
379 | o 4 c
380 | |
381 | o 3 b
382 | |
383 | o 2 1
384 |/
385 o 1 a
386 |
387 @ 0 base
388
389 $ hg summary
390 parent: 0:df4f53cec30a
391 base
392 branch: default
393 commit: (clean)
394 update: 6 new changesets (update)
395 phases: 7 draft
396
397 $ cd ..
326 On the other hand, make sure we *do* clobber changes whenever we
398 On the other hand, make sure we *do* clobber changes whenever we
327 haven't somehow managed to update the repo to a different revision
399 haven't somehow managed to update the repo to a different revision
328 during a rebase (issue4661)
400 during a rebase (issue4661)
General Comments 0
You need to be logged in to leave comments. Login now