comparison tests/test-hook.t @ 24821:57f1dbc99631 stable

afterlock: add the callback to the top level lock (issue4608) If 'wlock' is taken, we should add 'afterlock' callback to the 'wlock' instead. Otherwise, running post transaction hook after 'lock' is release but 'wlock' is still taken lead to a deadlock (eg: 'hg update' during a hook). This situation is much more common since: 5dc5cd7abbf5 push: acquire local 'wlock' if "pushback" is expected (BC) (issue4596)
author Pierre-Yves David <pierre-yves.david@fb.com>
date Mon, 20 Apr 2015 15:27:55 +0200
parents 7d0421de8de3
children 2f2de8a7f97f
comparison
equal deleted inserted replaced
24820:6a6b69d9e539 24821:57f1dbc99631
1 commit hooks can see env vars 1 commit hooks can see env vars
2 (and post-transaction one are run unlocked)
2 3
3 $ hg init a 4 $ hg init a
4 $ cd a 5 $ cd a
5 $ cat > .hg/hgrc <<EOF 6 $ cat > .hg/hgrc <<EOF
6 > [hooks] 7 > [hooks]
14 > post-cat = python "$TESTDIR/printenv.py" post-cat 15 > post-cat = python "$TESTDIR/printenv.py" post-cat
15 > pretxnopen = sh -c "HG_LOCAL= HG_TAG= python \"$TESTDIR/printenv.py\" pretxnopen" 16 > pretxnopen = sh -c "HG_LOCAL= HG_TAG= python \"$TESTDIR/printenv.py\" pretxnopen"
16 > pretxnclose = sh -c "HG_LOCAL= HG_TAG= python \"$TESTDIR/printenv.py\" pretxnclose" 17 > pretxnclose = sh -c "HG_LOCAL= HG_TAG= python \"$TESTDIR/printenv.py\" pretxnclose"
17 > txnclose = sh -c "HG_LOCAL= HG_TAG= python \"$TESTDIR/printenv.py\" txnclose" 18 > txnclose = sh -c "HG_LOCAL= HG_TAG= python \"$TESTDIR/printenv.py\" txnclose"
18 > txnabort = sh -c "HG_LOCAL= HG_TAG= python \"$TESTDIR/printenv.py\" txnabort" 19 > txnabort = sh -c "HG_LOCAL= HG_TAG= python \"$TESTDIR/printenv.py\" txnabort"
20 > txnclose.checklock = hg debuglock > /dev/null
19 > EOF 21 > EOF
20 $ echo a > a 22 $ echo a > a
21 $ hg add a 23 $ hg add a
22 $ hg commit -m a 24 $ hg commit -m a
23 precommit hook: HG_PARENT1=0000000000000000000000000000000000000000 25 precommit hook: HG_PARENT1=0000000000000000000000000000000000000000