diff 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
line wrap: on
line diff
--- a/tests/test-histedit-fold.t	Sat Nov 01 22:59:37 2014 +0000
+++ b/tests/test-histedit-fold.t	Sat Nov 01 23:17:50 2014 +0000
@@ -446,3 +446,45 @@
   0:6c795aa153cb a
 
   $ cd ..
+
+Folding with swapping
+---------------------
+
+This is an excuse to test hook with histedit temporary commit (issue4422)
+
+
+  $ hg init issue4422
+  $ cd issue4422
+  $ echo a > a.txt
+  $ hg add a.txt
+  $ hg commit -m a
+  $ echo b > b.txt
+  $ hg add b.txt
+  $ hg commit -m b
+  $ echo c > c.txt
+  $ hg add c.txt
+  $ hg commit -m c
+
+  $ hg logt
+  2:a1a953ffb4b0 c
+  1:199b6bb90248 b
+  0:6c795aa153cb a
+
+  $ hg histedit 6c795aa153cb --config hooks.commit="echo commit \$HG_NODE" --commands - 2>&1 << EOF | fixbundle
+  > pick 199b6bb90248 b
+  > fold a1a953ffb4b0 c
+  > pick 6c795aa153cb a
+  > EOF
+  0 files updated, 0 files merged, 3 files removed, 0 files unresolved
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
+  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  commit 9599899f62c05f4377548c32bf1c9f1a39634b0c
+
+  $ hg logt
+  1:9599899f62c0 a
+  0:79b99e9c8e49 b
+
+  $ cd ..