Show More
@@ -833,6 +833,10 b' variables it is passed are listed with n' | |||||
833 | after the lock is released. see ``pretxnclose`` docs for details about |
|
833 | after the lock is released. see ``pretxnclose`` docs for details about | |
834 | available variables. |
|
834 | available variables. | |
835 |
|
835 | |||
|
836 | ``txnabort`` | |||
|
837 | Run when a transaction is aborted. see ``pretxnclose`` docs for details about | |||
|
838 | available variables. | |||
|
839 | ||||
836 | ``pretxnchangegroup`` |
|
840 | ``pretxnchangegroup`` | |
837 | Run after a changegroup has been added via push, pull or unbundle, |
|
841 | Run after a changegroup has been added via push, pull or unbundle, | |
838 | but before the transaction has been committed. Changegroup is |
|
842 | but before the transaction has been committed. Changegroup is |
@@ -975,6 +975,12 b' class localrepository(object):' | |||||
975 | **tr2.hookargs) |
|
975 | **tr2.hookargs) | |
976 | reporef()._afterlock(hook) |
|
976 | reporef()._afterlock(hook) | |
977 | tr.addfinalize('txnclose-hook', txnclosehook) |
|
977 | tr.addfinalize('txnclose-hook', txnclosehook) | |
|
978 | def txnaborthook(tr2): | |||
|
979 | """To be run if transaction is aborted | |||
|
980 | """ | |||
|
981 | reporef().hook('txnabort', throw=False, txnname=desc, | |||
|
982 | **tr2.hookargs) | |||
|
983 | tr.addabort('txnabort-hook', txnaborthook) | |||
978 | self._transref = weakref.ref(tr) |
|
984 | self._transref = weakref.ref(tr) | |
979 | return tr |
|
985 | return tr | |
980 |
|
986 |
@@ -15,6 +15,7 b' commit hooks can see env vars' | |||||
15 | > pretxnopen = sh -c "HG_LOCAL= HG_TAG= python \"$TESTDIR/printenv.py\" pretxnopen" |
|
15 | > 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" |
|
16 | > 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" |
|
17 | > 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" | |||
18 | > EOF |
|
19 | > EOF | |
19 | $ echo a > a |
|
20 | $ echo a > a | |
20 | $ hg add a |
|
21 | $ hg add a | |
@@ -161,6 +162,7 b' more there after' | |||||
161 | 5:6f611f8018c1 |
|
162 | 5:6f611f8018c1 | |
162 | pretxncommit.forbid hook: HG_NODE=6f611f8018c10e827fee6bd2bc807f937e761567 HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PENDING=$TESTTMP/a |
|
163 | pretxncommit.forbid hook: HG_NODE=6f611f8018c10e827fee6bd2bc807f937e761567 HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PENDING=$TESTTMP/a | |
163 | transaction abort! |
|
164 | transaction abort! | |
|
165 | txnabort hook: HG_TXNID=TXN:* HG_TXNNAME=commit (glob) | |||
164 | rollback completed |
|
166 | rollback completed | |
165 | abort: pretxncommit.forbid1 hook exited with status 1 |
|
167 | abort: pretxncommit.forbid1 hook exited with status 1 | |
166 | [255] |
|
168 | [255] |
General Comments 0
You need to be logged in to leave comments.
Login now