comparison tests/test-histedit-fold.t @ 23129:eb315418224c stable

hook: protect commit hooks against stripping of temporary commit (issue4422) History rewriting commands like histedit tend to use temporary commits. They may schedule hook execution on these temporary commits for after the lock has been released. But temporary commits are likely to have been stripped before the lock is released (and the hook run). Hook executed for missing revisions leads to various crashes. We disable hooks execution for revision missing in the repo. This provides a dirty but simple fix to user issues.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Sat, 01 Nov 2014 23:17:50 +0000
parents 3ddfb9b3fdc6
children 6a3e38a173ec
comparison
equal deleted inserted replaced
23128:b6f7cf47f5d1 23129:eb315418224c
444 $ hg logt --follow b.txt 444 $ hg logt --follow b.txt
445 1:cf858d235c76 rename 445 1:cf858d235c76 rename
446 0:6c795aa153cb a 446 0:6c795aa153cb a
447 447
448 $ cd .. 448 $ cd ..
449
450 Folding with swapping
451 ---------------------
452
453 This is an excuse to test hook with histedit temporary commit (issue4422)
454
455
456 $ hg init issue4422
457 $ cd issue4422
458 $ echo a > a.txt
459 $ hg add a.txt
460 $ hg commit -m a
461 $ echo b > b.txt
462 $ hg add b.txt
463 $ hg commit -m b
464 $ echo c > c.txt
465 $ hg add c.txt
466 $ hg commit -m c
467
468 $ hg logt
469 2:a1a953ffb4b0 c
470 1:199b6bb90248 b
471 0:6c795aa153cb a
472
473 $ hg histedit 6c795aa153cb --config hooks.commit="echo commit \$HG_NODE" --commands - 2>&1 << EOF | fixbundle
474 > pick 199b6bb90248 b
475 > fold a1a953ffb4b0 c
476 > pick 6c795aa153cb a
477 > EOF
478 0 files updated, 0 files merged, 3 files removed, 0 files unresolved
479 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
480 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
481 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
482 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
483 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
484 commit 9599899f62c05f4377548c32bf1c9f1a39634b0c
485
486 $ hg logt
487 1:9599899f62c0 a
488 0:79b99e9c8e49 b
489
490 $ cd ..