Show More
@@ -813,6 +813,16 b' variables it is passed are listed with n' | |||||
813 | transaction will be in ``$HG_TXNNAME``. A non-zero status will |
|
813 | transaction will be in ``$HG_TXNNAME``. A non-zero status will | |
814 | prevent the transaction from being opened. |
|
814 | prevent the transaction from being opened. | |
815 |
|
815 | |||
|
816 | ``txnclose`` | |||
|
817 | Run after any repository transaction has been commited. At this | |||
|
818 | point, the transaction can no longer be rolled back. The hook will run | |||
|
819 | after the lock is released. The reason for the transaction will | |||
|
820 | be in ``$HG_TXNNAME``. The rest of the available data will vary | |||
|
821 | according the event that happened during the transaction. New changesets | |||
|
822 | will add ``$HG_NODE`` (id of the first added changeset), ``$HG_URL`` | |||
|
823 | and ``$HG_SOURCE`` variables, bookmarks and phases changes will set | |||
|
824 | ``HG_BOOKMARK_MOVED`` and ``HG_PHASES_MOVED`` to ``1``, etc. | |||
|
825 | ||||
816 | ``pretxnchangegroup`` |
|
826 | ``pretxnchangegroup`` | |
817 | Run after a changegroup has been added via push, pull or unbundle, |
|
827 | Run after a changegroup has been added via push, pull or unbundle, | |
818 | but before the transaction has been committed. Changegroup is |
|
828 | but before the transaction has been committed. Changegroup is |
@@ -924,6 +924,16 b' class localrepository(object):' | |||||
924 | # outdated when running hooks. As fncache is used for streaming clone, |
|
924 | # outdated when running hooks. As fncache is used for streaming clone, | |
925 | # this is not expected to break anything that happen during the hooks. |
|
925 | # this is not expected to break anything that happen during the hooks. | |
926 | tr.addfinalize('flush-fncache', self.store.write) |
|
926 | tr.addfinalize('flush-fncache', self.store.write) | |
|
927 | # we must avoid cyclic reference between repo and transaction. | |||
|
928 | reporef = weakref.ref(self) | |||
|
929 | def txnclosehook(tr2): | |||
|
930 | """To be run if transaction is successful, will schedule a hook run | |||
|
931 | """ | |||
|
932 | def hook(): | |||
|
933 | reporef().hook('txnclose', throw=False, txnname=desc, | |||
|
934 | **tr2.hookargs) | |||
|
935 | reporef()._afterlock(hook) | |||
|
936 | tr.addfinalize('txnclose-hook', txnclosehook) | |||
927 | self._transref = weakref.ref(tr) |
|
937 | self._transref = weakref.ref(tr) | |
928 | return tr |
|
938 | return tr | |
929 |
|
939 |
@@ -13,6 +13,7 b' commit hooks can see env vars' | |||||
13 | > pre-cat = python "$TESTDIR/printenv.py" pre-cat |
|
13 | > pre-cat = python "$TESTDIR/printenv.py" pre-cat | |
14 | > post-cat = python "$TESTDIR/printenv.py" post-cat |
|
14 | > post-cat = python "$TESTDIR/printenv.py" post-cat | |
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 | > txnclose = sh -c "HG_LOCAL= HG_TAG= python \"$TESTDIR/printenv.py\" txnclose" | |||
16 | > EOF |
|
17 | > EOF | |
17 | $ echo a > a |
|
18 | $ echo a > a | |
18 | $ hg add a |
|
19 | $ hg add a | |
@@ -21,6 +22,7 b' commit hooks can see env vars' | |||||
21 | pretxnopen hook: HG_TXNNAME=commit |
|
22 | pretxnopen hook: HG_TXNNAME=commit | |
22 | pretxncommit hook: HG_NODE=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PARENT1=0000000000000000000000000000000000000000 HG_PENDING=$TESTTMP/a |
|
23 | pretxncommit hook: HG_NODE=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PARENT1=0000000000000000000000000000000000000000 HG_PENDING=$TESTTMP/a | |
23 | 0:cb9a9f314b8b |
|
24 | 0:cb9a9f314b8b | |
|
25 | txnclose hook: HG_PHASES_MOVED=1 HG_TXNNAME=commit | |||
24 | commit hook: HG_NODE=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PARENT1=0000000000000000000000000000000000000000 |
|
26 | commit hook: HG_NODE=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PARENT1=0000000000000000000000000000000000000000 | |
25 | commit.b hook: HG_NODE=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PARENT1=0000000000000000000000000000000000000000 |
|
27 | commit.b hook: HG_NODE=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PARENT1=0000000000000000000000000000000000000000 | |
26 |
|
28 | |||
@@ -47,6 +49,7 b' pretxncommit and commit hooks can see bo' | |||||
47 | pretxnopen hook: HG_TXNNAME=commit |
|
49 | pretxnopen hook: HG_TXNNAME=commit | |
48 | pretxncommit hook: HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PENDING=$TESTTMP/a |
|
50 | pretxncommit hook: HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PENDING=$TESTTMP/a | |
49 | 1:ab228980c14d |
|
51 | 1:ab228980c14d | |
|
52 | txnclose hook: HG_TXNNAME=commit | |||
50 | commit hook: HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b |
|
53 | commit hook: HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b | |
51 | commit.b hook: HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b |
|
54 | commit.b hook: HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b | |
52 | $ hg update -C 0 |
|
55 | $ hg update -C 0 | |
@@ -58,6 +61,7 b' pretxncommit and commit hooks can see bo' | |||||
58 | pretxnopen hook: HG_TXNNAME=commit |
|
61 | pretxnopen hook: HG_TXNNAME=commit | |
59 | pretxncommit hook: HG_NODE=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PENDING=$TESTTMP/a |
|
62 | pretxncommit hook: HG_NODE=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PENDING=$TESTTMP/a | |
60 | 2:ee9deb46ab31 |
|
63 | 2:ee9deb46ab31 | |
|
64 | txnclose hook: HG_TXNNAME=commit | |||
61 | commit hook: HG_NODE=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b |
|
65 | commit hook: HG_NODE=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b | |
62 | commit.b hook: HG_NODE=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b |
|
66 | commit.b hook: HG_NODE=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b | |
63 | created new head |
|
67 | created new head | |
@@ -69,6 +73,7 b' pretxncommit and commit hooks can see bo' | |||||
69 | pretxnopen hook: HG_TXNNAME=commit |
|
73 | pretxnopen hook: HG_TXNNAME=commit | |
70 | pretxncommit hook: HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_PARENT1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT2=ab228980c14deea8b9555d91c9581127383e40fd HG_PENDING=$TESTTMP/a |
|
74 | pretxncommit hook: HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_PARENT1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT2=ab228980c14deea8b9555d91c9581127383e40fd HG_PENDING=$TESTTMP/a | |
71 | 3:07f3376c1e65 |
|
75 | 3:07f3376c1e65 | |
|
76 | txnclose hook: HG_TXNNAME=commit | |||
72 | commit hook: HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_PARENT1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT2=ab228980c14deea8b9555d91c9581127383e40fd |
|
77 | commit hook: HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_PARENT1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT2=ab228980c14deea8b9555d91c9581127383e40fd | |
73 | commit.b hook: HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_PARENT1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT2=ab228980c14deea8b9555d91c9581127383e40fd |
|
78 | commit.b hook: HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_PARENT1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT2=ab228980c14deea8b9555d91c9581127383e40fd | |
74 |
|
79 | |||
@@ -112,6 +117,7 b' tag hooks can see env vars' | |||||
112 | pretxncommit hook: HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PARENT1=07f3376c1e655977439df2a814e3cc14b27abac2 HG_PENDING=$TESTTMP/a |
|
117 | pretxncommit hook: HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PARENT1=07f3376c1e655977439df2a814e3cc14b27abac2 HG_PENDING=$TESTTMP/a | |
113 | 4:539e4b31b6dc |
|
118 | 4:539e4b31b6dc | |
114 | tag hook: HG_LOCAL=0 HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_TAG=a |
|
119 | tag hook: HG_LOCAL=0 HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_TAG=a | |
|
120 | txnclose hook: HG_TXNNAME=commit | |||
115 | commit hook: HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PARENT1=07f3376c1e655977439df2a814e3cc14b27abac2 |
|
121 | commit hook: HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PARENT1=07f3376c1e655977439df2a814e3cc14b27abac2 | |
116 | commit.b hook: HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PARENT1=07f3376c1e655977439df2a814e3cc14b27abac2 |
|
122 | commit.b hook: HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PARENT1=07f3376c1e655977439df2a814e3cc14b27abac2 | |
117 | $ hg tag -l la |
|
123 | $ hg tag -l la | |
@@ -206,6 +212,7 b' pushkey hook' | |||||
206 | searching for changes |
|
212 | searching for changes | |
207 | no changes found |
|
213 | no changes found | |
208 | pretxnopen hook: HG_TXNNAME=bookmarks |
|
214 | pretxnopen hook: HG_TXNNAME=bookmarks | |
|
215 | txnclose hook: HG_BOOKMARK_MOVED=1 HG_TXNNAME=bookmarks | |||
209 | pushkey hook: HG_KEY=foo HG_NAMESPACE=bookmarks HG_NEW=0000000000000000000000000000000000000000 HG_RET=1 |
|
216 | pushkey hook: HG_KEY=foo HG_NAMESPACE=bookmarks HG_NEW=0000000000000000000000000000000000000000 HG_RET=1 | |
210 | exporting bookmark foo |
|
217 | exporting bookmark foo | |
211 | [1] |
|
218 | [1] |
General Comments 0
You need to be logged in to leave comments.
Login now