##// END OF EJS Templates
hook: have a generic hook for transaction opening...
Pierre-Yves David -
r24281:e9ede9b4 default
parent child Browse files
Show More
@@ -808,6 +808,11 b' variables it is passed are listed with n'
808 808 changeset to tag is in ``$HG_NODE``. Name of tag is in ``$HG_TAG``. Tag is
809 809 local if ``$HG_LOCAL=1``, in repository if ``$HG_LOCAL=0``.
810 810
811 ``pretxnopen``
812 Run before any new repository transaction is open. The reason for the
813 transaction will be in ``$HG_TXNNAME``. A non-zero status will
814 prevent the transaction from being opened.
815
811 816 ``pretxnchangegroup``
812 817 Run after a changegroup has been added via push, pull or unbundle,
813 818 but before the transaction has been committed. Changegroup is
@@ -909,6 +909,8 b' class localrepository(object):'
909 909 _("abandoned transaction found"),
910 910 hint=_("run 'hg recover' to clean up transaction"))
911 911
912 self.hook('pretxnopen', throw=True, txnname=desc)
913
912 914 self._writejournal(desc)
913 915 renames = [(vfs, x, undoname(x)) for vfs, x in self._journalfiles()]
914 916 rp = report and report or self.ui.warn
@@ -12,11 +12,13 b' commit hooks can see env vars'
12 12 > pre-identify = python "$TESTDIR/printenv.py" pre-identify 1
13 13 > pre-cat = python "$TESTDIR/printenv.py" pre-cat
14 14 > post-cat = python "$TESTDIR/printenv.py" post-cat
15 > pretxnopen = sh -c "HG_LOCAL= HG_TAG= python \"$TESTDIR/printenv.py\" pretxnopen"
15 16 > EOF
16 17 $ echo a > a
17 18 $ hg add a
18 19 $ hg commit -m a
19 20 precommit hook: HG_PARENT1=0000000000000000000000000000000000000000
21 pretxnopen hook: HG_TXNNAME=commit
20 22 pretxncommit hook: HG_NODE=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PARENT1=0000000000000000000000000000000000000000 HG_PENDING=$TESTTMP/a
21 23 0:cb9a9f314b8b
22 24 commit hook: HG_NODE=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PARENT1=0000000000000000000000000000000000000000
@@ -42,6 +44,7 b' pretxncommit and commit hooks can see bo'
42 44 $ echo b >> a
43 45 $ hg commit -m a1 -d "1 0"
44 46 precommit hook: HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
47 pretxnopen hook: HG_TXNNAME=commit
45 48 pretxncommit hook: HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PENDING=$TESTTMP/a
46 49 1:ab228980c14d
47 50 commit hook: HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
@@ -52,6 +55,7 b' pretxncommit and commit hooks can see bo'
52 55 $ hg add b
53 56 $ hg commit -m b -d '1 0'
54 57 precommit hook: HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
58 pretxnopen hook: HG_TXNNAME=commit
55 59 pretxncommit hook: HG_NODE=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PENDING=$TESTTMP/a
56 60 2:ee9deb46ab31
57 61 commit hook: HG_NODE=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
@@ -62,6 +66,7 b' pretxncommit and commit hooks can see bo'
62 66 (branch merge, don't forget to commit)
63 67 $ hg commit -m merge -d '2 0'
64 68 precommit hook: HG_PARENT1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT2=ab228980c14deea8b9555d91c9581127383e40fd
69 pretxnopen hook: HG_TXNNAME=commit
65 70 pretxncommit hook: HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_PARENT1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT2=ab228980c14deea8b9555d91c9581127383e40fd HG_PENDING=$TESTTMP/a
66 71 3:07f3376c1e65
67 72 commit hook: HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_PARENT1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT2=ab228980c14deea8b9555d91c9581127383e40fd
@@ -103,6 +108,7 b' tag hooks can see env vars'
103 108 $ hg tag -d '3 0' a
104 109 pretag hook: HG_LOCAL=0 HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_TAG=a
105 110 precommit hook: HG_PARENT1=07f3376c1e655977439df2a814e3cc14b27abac2
111 pretxnopen hook: HG_TXNNAME=commit
106 112 pretxncommit hook: HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PARENT1=07f3376c1e655977439df2a814e3cc14b27abac2 HG_PENDING=$TESTTMP/a
107 113 4:539e4b31b6dc
108 114 tag hook: HG_LOCAL=0 HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_TAG=a
@@ -137,6 +143,7 b' more there after'
137 143 4:539e4b31b6dc
138 144 $ hg commit -m 'fail' -d '4 0'
139 145 precommit hook: HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10
146 pretxnopen hook: HG_TXNNAME=commit
140 147 pretxncommit hook: HG_NODE=6f611f8018c10e827fee6bd2bc807f937e761567 HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PENDING=$TESTTMP/a
141 148 5:6f611f8018c1
142 149 5:6f611f8018c1
@@ -198,6 +205,7 b' pushkey hook'
198 205 pushing to ../a
199 206 searching for changes
200 207 no changes found
208 pretxnopen hook: HG_TXNNAME=bookmarks
201 209 pushkey hook: HG_KEY=foo HG_NAMESPACE=bookmarks HG_NEW=0000000000000000000000000000000000000000 HG_RET=1
202 210 exporting bookmark foo
203 211 [1]
General Comments 0
You need to be logged in to leave comments. Login now