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