##// END OF EJS Templates
test: use `printenv.py --line` in `test-hook.t`...
Boris Feld -
r41788:f8443db3 default
parent child Browse files
Show More
This diff has been collapsed as it changes many lines, (653 lines changed) Show them Hide them
@@ -14,32 +14,63 b' commit hooks can see env vars'
14 14 $ cd a
15 15 $ cat > .hg/hgrc <<EOF
16 16 > [hooks]
17 > commit = sh -c "HG_LOCAL= HG_TAG= printenv.py commit"
18 > commit.b = sh -c "HG_LOCAL= HG_TAG= printenv.py commit.b"
19 > precommit = sh -c "HG_LOCAL= HG_NODE= HG_TAG= printenv.py precommit"
20 > pretxncommit = sh -c "HG_LOCAL= HG_TAG= printenv.py pretxncommit"
17 > commit = sh -c "HG_LOCAL= HG_TAG= printenv.py --line commit"
18 > commit.b = sh -c "HG_LOCAL= HG_TAG= printenv.py --line commit.b"
19 > precommit = sh -c "HG_LOCAL= HG_NODE= HG_TAG= printenv.py --line precommit"
20 > pretxncommit = sh -c "HG_LOCAL= HG_TAG= printenv.py --line pretxncommit"
21 21 > pretxncommit.tip = hg -q tip
22 > pre-identify = sh -c "printenv.py pre-identify 1"
23 > pre-cat = sh -c "printenv.py pre-cat"
24 > post-cat = sh -c "printenv.py post-cat"
25 > pretxnopen = sh -c "HG_LOCAL= HG_TAG= printenv.py pretxnopen"
26 > pretxnclose = sh -c "HG_LOCAL= HG_TAG= printenv.py pretxnclose"
27 > txnclose = sh -c "HG_LOCAL= HG_TAG= printenv.py txnclose"
22 > pre-identify = sh -c "printenv.py --line pre-identify 1"
23 > pre-cat = sh -c "printenv.py --line pre-cat"
24 > post-cat = sh -c "printenv.py --line post-cat"
25 > pretxnopen = sh -c "HG_LOCAL= HG_TAG= printenv.py --line pretxnopen"
26 > pretxnclose = sh -c "HG_LOCAL= HG_TAG= printenv.py --line pretxnclose"
27 > txnclose = sh -c "HG_LOCAL= HG_TAG= printenv.py --line txnclose"
28 28 > txnabort.0 = python:$TESTTMP/txnabort.checkargs.py:showargs
29 > txnabort.1 = sh -c "HG_LOCAL= HG_TAG= printenv.py txnabort"
29 > txnabort.1 = sh -c "HG_LOCAL= HG_TAG= printenv.py --line txnabort"
30 30 > txnclose.checklock = sh -c "hg debuglock > /dev/null"
31 31 > EOF
32 32 $ echo a > a
33 33 $ hg add a
34 34 $ hg commit -m a
35 precommit hook: HG_HOOKNAME=precommit HG_HOOKTYPE=precommit HG_PARENT1=0000000000000000000000000000000000000000
36 pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=commit
37 pretxncommit hook: HG_HOOKNAME=pretxncommit HG_HOOKTYPE=pretxncommit HG_NODE=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PARENT1=0000000000000000000000000000000000000000 HG_PENDING=$TESTTMP/a
35 precommit hook: HG_HOOKNAME=precommit
36 HG_HOOKTYPE=precommit
37 HG_PARENT1=0000000000000000000000000000000000000000
38
39 pretxnopen hook: HG_HOOKNAME=pretxnopen
40 HG_HOOKTYPE=pretxnopen
41 HG_TXNID=TXN:$ID$
42 HG_TXNNAME=commit
43
44 pretxncommit hook: HG_HOOKNAME=pretxncommit
45 HG_HOOKTYPE=pretxncommit
46 HG_NODE=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
47 HG_PARENT1=0000000000000000000000000000000000000000
48 HG_PENDING=$TESTTMP/a
49
38 50 0:cb9a9f314b8b
39 pretxnclose hook: HG_HOOKNAME=pretxnclose HG_HOOKTYPE=pretxnclose HG_PENDING=$TESTTMP/a HG_PHASES_MOVED=1 HG_TXNID=TXN:$ID$ HG_TXNNAME=commit
40 txnclose hook: HG_HOOKNAME=txnclose HG_HOOKTYPE=txnclose HG_PHASES_MOVED=1 HG_TXNID=TXN:$ID$ HG_TXNNAME=commit
41 commit hook: HG_HOOKNAME=commit HG_HOOKTYPE=commit HG_NODE=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PARENT1=0000000000000000000000000000000000000000
42 commit.b hook: HG_HOOKNAME=commit.b HG_HOOKTYPE=commit HG_NODE=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PARENT1=0000000000000000000000000000000000000000
51 pretxnclose hook: HG_HOOKNAME=pretxnclose
52 HG_HOOKTYPE=pretxnclose
53 HG_PENDING=$TESTTMP/a
54 HG_PHASES_MOVED=1
55 HG_TXNID=TXN:$ID$
56 HG_TXNNAME=commit
57
58 txnclose hook: HG_HOOKNAME=txnclose
59 HG_HOOKTYPE=txnclose
60 HG_PHASES_MOVED=1
61 HG_TXNID=TXN:$ID$
62 HG_TXNNAME=commit
63
64 commit hook: HG_HOOKNAME=commit
65 HG_HOOKTYPE=commit
66 HG_NODE=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
67 HG_PARENT1=0000000000000000000000000000000000000000
68
69 commit.b hook: HG_HOOKNAME=commit.b
70 HG_HOOKTYPE=commit
71 HG_NODE=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
72 HG_PARENT1=0000000000000000000000000000000000000000
73
43 74
44 75 $ hg clone . ../b
45 76 updating to branch default
@@ -50,9 +81,9 b' changegroup hooks can see env vars'
50 81
51 82 $ cat > .hg/hgrc <<EOF
52 83 > [hooks]
53 > prechangegroup = sh -c "printenv.py prechangegroup"
54 > changegroup = sh -c "printenv.py changegroup"
55 > incoming = sh -c "printenv.py incoming"
84 > prechangegroup = sh -c "printenv.py --line prechangegroup"
85 > changegroup = sh -c "printenv.py --line changegroup"
86 > incoming = sh -c "printenv.py --line incoming"
56 87 > EOF
57 88
58 89 pretxncommit and commit hooks can see both parents of merge
@@ -60,103 +91,309 b' pretxncommit and commit hooks can see bo'
60 91 $ cd ../a
61 92 $ echo b >> a
62 93 $ hg commit -m a1 -d "1 0"
63 precommit hook: HG_HOOKNAME=precommit HG_HOOKTYPE=precommit HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
64 pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=commit
65 pretxncommit hook: HG_HOOKNAME=pretxncommit HG_HOOKTYPE=pretxncommit HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PENDING=$TESTTMP/a
94 precommit hook: HG_HOOKNAME=precommit
95 HG_HOOKTYPE=precommit
96 HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
97
98 pretxnopen hook: HG_HOOKNAME=pretxnopen
99 HG_HOOKTYPE=pretxnopen
100 HG_TXNID=TXN:$ID$
101 HG_TXNNAME=commit
102
103 pretxncommit hook: HG_HOOKNAME=pretxncommit
104 HG_HOOKTYPE=pretxncommit
105 HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd
106 HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
107 HG_PENDING=$TESTTMP/a
108
66 109 1:ab228980c14d
67 pretxnclose hook: HG_HOOKNAME=pretxnclose HG_HOOKTYPE=pretxnclose HG_PENDING=$TESTTMP/a HG_TXNID=TXN:$ID$ HG_TXNNAME=commit
68 txnclose hook: HG_HOOKNAME=txnclose HG_HOOKTYPE=txnclose HG_TXNID=TXN:$ID$ HG_TXNNAME=commit
69 commit hook: HG_HOOKNAME=commit HG_HOOKTYPE=commit HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
70 commit.b hook: HG_HOOKNAME=commit.b HG_HOOKTYPE=commit HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
110 pretxnclose hook: HG_HOOKNAME=pretxnclose
111 HG_HOOKTYPE=pretxnclose
112 HG_PENDING=$TESTTMP/a
113 HG_TXNID=TXN:$ID$
114 HG_TXNNAME=commit
115
116 txnclose hook: HG_HOOKNAME=txnclose
117 HG_HOOKTYPE=txnclose
118 HG_TXNID=TXN:$ID$
119 HG_TXNNAME=commit
120
121 commit hook: HG_HOOKNAME=commit
122 HG_HOOKTYPE=commit
123 HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd
124 HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
125
126 commit.b hook: HG_HOOKNAME=commit.b
127 HG_HOOKTYPE=commit
128 HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd
129 HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
130
71 131 $ hg update -C 0
72 132 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
73 133 $ echo b > b
74 134 $ hg add b
75 135 $ hg commit -m b -d '1 0'
76 precommit hook: HG_HOOKNAME=precommit HG_HOOKTYPE=precommit HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
77 pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=commit
78 pretxncommit hook: HG_HOOKNAME=pretxncommit HG_HOOKTYPE=pretxncommit HG_NODE=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PENDING=$TESTTMP/a
136 precommit hook: HG_HOOKNAME=precommit
137 HG_HOOKTYPE=precommit
138 HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
139
140 pretxnopen hook: HG_HOOKNAME=pretxnopen
141 HG_HOOKTYPE=pretxnopen
142 HG_TXNID=TXN:$ID$
143 HG_TXNNAME=commit
144
145 pretxncommit hook: HG_HOOKNAME=pretxncommit
146 HG_HOOKTYPE=pretxncommit
147 HG_NODE=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2
148 HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
149 HG_PENDING=$TESTTMP/a
150
79 151 2:ee9deb46ab31
80 pretxnclose hook: HG_HOOKNAME=pretxnclose HG_HOOKTYPE=pretxnclose HG_PENDING=$TESTTMP/a HG_TXNID=TXN:$ID$ HG_TXNNAME=commit
152 pretxnclose hook: HG_HOOKNAME=pretxnclose
153 HG_HOOKTYPE=pretxnclose
154 HG_PENDING=$TESTTMP/a
155 HG_TXNID=TXN:$ID$
156 HG_TXNNAME=commit
157
81 158 created new head
82 txnclose hook: HG_HOOKNAME=txnclose HG_HOOKTYPE=txnclose HG_TXNID=TXN:$ID$ HG_TXNNAME=commit
83 commit hook: HG_HOOKNAME=commit HG_HOOKTYPE=commit HG_NODE=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
84 commit.b hook: HG_HOOKNAME=commit.b HG_HOOKTYPE=commit HG_NODE=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
159 txnclose hook: HG_HOOKNAME=txnclose
160 HG_HOOKTYPE=txnclose
161 HG_TXNID=TXN:$ID$
162 HG_TXNNAME=commit
163
164 commit hook: HG_HOOKNAME=commit
165 HG_HOOKTYPE=commit
166 HG_NODE=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2
167 HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
168
169 commit.b hook: HG_HOOKNAME=commit.b
170 HG_HOOKTYPE=commit
171 HG_NODE=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2
172 HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
173
85 174 $ hg merge 1
86 175 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
87 176 (branch merge, don't forget to commit)
88 177 $ hg commit -m merge -d '2 0'
89 precommit hook: HG_HOOKNAME=precommit HG_HOOKTYPE=precommit HG_PARENT1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT2=ab228980c14deea8b9555d91c9581127383e40fd
90 pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=commit
91 pretxncommit hook: HG_HOOKNAME=pretxncommit HG_HOOKTYPE=pretxncommit HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_PARENT1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT2=ab228980c14deea8b9555d91c9581127383e40fd HG_PENDING=$TESTTMP/a
178 precommit hook: HG_HOOKNAME=precommit
179 HG_HOOKTYPE=precommit
180 HG_PARENT1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2
181 HG_PARENT2=ab228980c14deea8b9555d91c9581127383e40fd
182
183 pretxnopen hook: HG_HOOKNAME=pretxnopen
184 HG_HOOKTYPE=pretxnopen
185 HG_TXNID=TXN:$ID$
186 HG_TXNNAME=commit
187
188 pretxncommit hook: HG_HOOKNAME=pretxncommit
189 HG_HOOKTYPE=pretxncommit
190 HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2
191 HG_PARENT1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2
192 HG_PARENT2=ab228980c14deea8b9555d91c9581127383e40fd
193 HG_PENDING=$TESTTMP/a
194
92 195 3:07f3376c1e65
93 pretxnclose hook: HG_HOOKNAME=pretxnclose HG_HOOKTYPE=pretxnclose HG_PENDING=$TESTTMP/a HG_TXNID=TXN:$ID$ HG_TXNNAME=commit
94 txnclose hook: HG_HOOKNAME=txnclose HG_HOOKTYPE=txnclose HG_TXNID=TXN:$ID$ HG_TXNNAME=commit
95 commit hook: HG_HOOKNAME=commit HG_HOOKTYPE=commit HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_PARENT1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT2=ab228980c14deea8b9555d91c9581127383e40fd
96 commit.b hook: HG_HOOKNAME=commit.b HG_HOOKTYPE=commit HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_PARENT1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT2=ab228980c14deea8b9555d91c9581127383e40fd
196 pretxnclose hook: HG_HOOKNAME=pretxnclose
197 HG_HOOKTYPE=pretxnclose
198 HG_PENDING=$TESTTMP/a
199 HG_TXNID=TXN:$ID$
200 HG_TXNNAME=commit
201
202 txnclose hook: HG_HOOKNAME=txnclose
203 HG_HOOKTYPE=txnclose
204 HG_TXNID=TXN:$ID$
205 HG_TXNNAME=commit
206
207 commit hook: HG_HOOKNAME=commit
208 HG_HOOKTYPE=commit
209 HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2
210 HG_PARENT1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2
211 HG_PARENT2=ab228980c14deea8b9555d91c9581127383e40fd
212
213 commit.b hook: HG_HOOKNAME=commit.b
214 HG_HOOKTYPE=commit
215 HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2
216 HG_PARENT1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2
217 HG_PARENT2=ab228980c14deea8b9555d91c9581127383e40fd
218
97 219
98 220 test generic hooks
99 221
100 222 $ hg id
101 pre-identify hook: HG_ARGS=id HG_HOOKNAME=pre-identify HG_HOOKTYPE=pre-identify HG_OPTS={'bookmarks': None, 'branch': None, 'id': None, 'insecure': None, 'num': None, 'remotecmd': '', 'rev': '', 'ssh': '', 'tags': None, 'template': ''} HG_PATS=[]
223 pre-identify hook: HG_ARGS=id
224 HG_HOOKNAME=pre-identify
225 HG_HOOKTYPE=pre-identify
226 HG_OPTS={'bookmarks': None, 'branch': None, 'id': None, 'insecure': None, 'num': None, 'remotecmd': '', 'rev': '', 'ssh': '', 'tags': None, 'template': ''}
227 HG_PATS=[]
228
102 229 abort: pre-identify hook exited with status 1
103 230 [255]
104 231 $ hg cat b
105 pre-cat hook: HG_ARGS=cat b HG_HOOKNAME=pre-cat HG_HOOKTYPE=pre-cat HG_OPTS={'decode': None, 'exclude': [], 'include': [], 'output': '', 'rev': '', 'template': ''} HG_PATS=['b']
232 pre-cat hook: HG_ARGS=cat b
233 HG_HOOKNAME=pre-cat
234 HG_HOOKTYPE=pre-cat
235 HG_OPTS={'decode': None, 'exclude': [], 'include': [], 'output': '', 'rev': '', 'template': ''}
236 HG_PATS=['b']
237
106 238 b
107 post-cat hook: HG_ARGS=cat b HG_HOOKNAME=post-cat HG_HOOKTYPE=post-cat HG_OPTS={'decode': None, 'exclude': [], 'include': [], 'output': '', 'rev': '', 'template': ''} HG_PATS=['b'] HG_RESULT=0
239 post-cat hook: HG_ARGS=cat b
240 HG_HOOKNAME=post-cat
241 HG_HOOKTYPE=post-cat
242 HG_OPTS={'decode': None, 'exclude': [], 'include': [], 'output': '', 'rev': '', 'template': ''}
243 HG_PATS=['b']
244 HG_RESULT=0
245
108 246
109 247 $ cd ../b
110 248 $ hg pull ../a
111 249 pulling from ../a
112 250 searching for changes
113 prechangegroup hook: HG_HOOKNAME=prechangegroup HG_HOOKTYPE=prechangegroup HG_SOURCE=pull HG_TXNID=TXN:$ID$ HG_URL=file:$TESTTMP/a
251 prechangegroup hook: HG_HOOKNAME=prechangegroup
252 HG_HOOKTYPE=prechangegroup
253 HG_SOURCE=pull
254 HG_TXNID=TXN:$ID$
255 HG_URL=file:$TESTTMP/a
256
114 257 adding changesets
115 258 adding manifests
116 259 adding file changes
117 260 added 3 changesets with 2 changes to 2 files
118 261 new changesets ab228980c14d:07f3376c1e65
119 changegroup hook: HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_NODE_LAST=07f3376c1e655977439df2a814e3cc14b27abac2 HG_SOURCE=pull HG_TXNID=TXN:$ID$ HG_URL=file:$TESTTMP/a
120 incoming hook: HG_HOOKNAME=incoming HG_HOOKTYPE=incoming HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_SOURCE=pull HG_TXNID=TXN:$ID$ HG_URL=file:$TESTTMP/a
121 incoming hook: HG_HOOKNAME=incoming HG_HOOKTYPE=incoming HG_NODE=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_SOURCE=pull HG_TXNID=TXN:$ID$ HG_URL=file:$TESTTMP/a
122 incoming hook: HG_HOOKNAME=incoming HG_HOOKTYPE=incoming HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_SOURCE=pull HG_TXNID=TXN:$ID$ HG_URL=file:$TESTTMP/a
262 changegroup hook: HG_HOOKNAME=changegroup
263 HG_HOOKTYPE=changegroup
264 HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd
265 HG_NODE_LAST=07f3376c1e655977439df2a814e3cc14b27abac2
266 HG_SOURCE=pull
267 HG_TXNID=TXN:$ID$
268 HG_URL=file:$TESTTMP/a
269
270 incoming hook: HG_HOOKNAME=incoming
271 HG_HOOKTYPE=incoming
272 HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd
273 HG_SOURCE=pull
274 HG_TXNID=TXN:$ID$
275 HG_URL=file:$TESTTMP/a
276
277 incoming hook: HG_HOOKNAME=incoming
278 HG_HOOKTYPE=incoming
279 HG_NODE=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2
280 HG_SOURCE=pull
281 HG_TXNID=TXN:$ID$
282 HG_URL=file:$TESTTMP/a
283
284 incoming hook: HG_HOOKNAME=incoming
285 HG_HOOKTYPE=incoming
286 HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2
287 HG_SOURCE=pull
288 HG_TXNID=TXN:$ID$
289 HG_URL=file:$TESTTMP/a
290
123 291 (run 'hg update' to get a working copy)
124 292
125 293 tag hooks can see env vars
126 294
127 295 $ cd ../a
128 296 $ cat >> .hg/hgrc <<EOF
129 > pretag = sh -c "printenv.py pretag"
130 > tag = sh -c "HG_PARENT1= HG_PARENT2= printenv.py tag"
297 > pretag = sh -c "printenv.py --line pretag"
298 > tag = sh -c "HG_PARENT1= HG_PARENT2= printenv.py --line tag"
131 299 > EOF
132 300 $ hg tag -d '3 0' a
133 pretag hook: HG_HOOKNAME=pretag HG_HOOKTYPE=pretag HG_LOCAL=0 HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_TAG=a
134 precommit hook: HG_HOOKNAME=precommit HG_HOOKTYPE=precommit HG_PARENT1=07f3376c1e655977439df2a814e3cc14b27abac2
135 pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=commit
136 pretxncommit hook: HG_HOOKNAME=pretxncommit HG_HOOKTYPE=pretxncommit HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PARENT1=07f3376c1e655977439df2a814e3cc14b27abac2 HG_PENDING=$TESTTMP/a
301 pretag hook: HG_HOOKNAME=pretag
302 HG_HOOKTYPE=pretag
303 HG_LOCAL=0
304 HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2
305 HG_TAG=a
306
307 precommit hook: HG_HOOKNAME=precommit
308 HG_HOOKTYPE=precommit
309 HG_PARENT1=07f3376c1e655977439df2a814e3cc14b27abac2
310
311 pretxnopen hook: HG_HOOKNAME=pretxnopen
312 HG_HOOKTYPE=pretxnopen
313 HG_TXNID=TXN:$ID$
314 HG_TXNNAME=commit
315
316 pretxncommit hook: HG_HOOKNAME=pretxncommit
317 HG_HOOKTYPE=pretxncommit
318 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10
319 HG_PARENT1=07f3376c1e655977439df2a814e3cc14b27abac2
320 HG_PENDING=$TESTTMP/a
321
137 322 4:539e4b31b6dc
138 pretxnclose hook: HG_HOOKNAME=pretxnclose HG_HOOKTYPE=pretxnclose HG_PENDING=$TESTTMP/a HG_TXNID=TXN:$ID$ HG_TXNNAME=commit
139 tag hook: HG_HOOKNAME=tag HG_HOOKTYPE=tag HG_LOCAL=0 HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_TAG=a
140 txnclose hook: HG_HOOKNAME=txnclose HG_HOOKTYPE=txnclose HG_TXNID=TXN:$ID$ HG_TXNNAME=commit
141 commit hook: HG_HOOKNAME=commit HG_HOOKTYPE=commit HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PARENT1=07f3376c1e655977439df2a814e3cc14b27abac2
142 commit.b hook: HG_HOOKNAME=commit.b HG_HOOKTYPE=commit HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PARENT1=07f3376c1e655977439df2a814e3cc14b27abac2
323 pretxnclose hook: HG_HOOKNAME=pretxnclose
324 HG_HOOKTYPE=pretxnclose
325 HG_PENDING=$TESTTMP/a
326 HG_TXNID=TXN:$ID$
327 HG_TXNNAME=commit
328
329 tag hook: HG_HOOKNAME=tag
330 HG_HOOKTYPE=tag
331 HG_LOCAL=0
332 HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2
333 HG_TAG=a
334
335 txnclose hook: HG_HOOKNAME=txnclose
336 HG_HOOKTYPE=txnclose
337 HG_TXNID=TXN:$ID$
338 HG_TXNNAME=commit
339
340 commit hook: HG_HOOKNAME=commit
341 HG_HOOKTYPE=commit
342 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10
343 HG_PARENT1=07f3376c1e655977439df2a814e3cc14b27abac2
344
345 commit.b hook: HG_HOOKNAME=commit.b
346 HG_HOOKTYPE=commit
347 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10
348 HG_PARENT1=07f3376c1e655977439df2a814e3cc14b27abac2
349
143 350 $ hg tag -l la
144 pretag hook: HG_HOOKNAME=pretag HG_HOOKTYPE=pretag HG_LOCAL=1 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=la
145 tag hook: HG_HOOKNAME=tag HG_HOOKTYPE=tag HG_LOCAL=1 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=la
351 pretag hook: HG_HOOKNAME=pretag
352 HG_HOOKTYPE=pretag
353 HG_LOCAL=1
354 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10
355 HG_TAG=la
356
357 tag hook: HG_HOOKNAME=tag
358 HG_HOOKTYPE=tag
359 HG_LOCAL=1
360 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10
361 HG_TAG=la
362
146 363
147 364 pretag hook can forbid tagging
148 365
149 366 $ cat >> .hg/hgrc <<EOF
150 > pretag.forbid = sh -c "printenv.py pretag.forbid 1"
367 > pretag.forbid = sh -c "printenv.py --line pretag.forbid 1"
151 368 > EOF
152 369 $ hg tag -d '4 0' fa
153 pretag hook: HG_HOOKNAME=pretag HG_HOOKTYPE=pretag HG_LOCAL=0 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=fa
154 pretag.forbid hook: HG_HOOKNAME=pretag.forbid HG_HOOKTYPE=pretag HG_LOCAL=0 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=fa
370 pretag hook: HG_HOOKNAME=pretag
371 HG_HOOKTYPE=pretag
372 HG_LOCAL=0
373 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10
374 HG_TAG=fa
375
376 pretag.forbid hook: HG_HOOKNAME=pretag.forbid
377 HG_HOOKTYPE=pretag
378 HG_LOCAL=0
379 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10
380 HG_TAG=fa
381
155 382 abort: pretag.forbid hook exited with status 1
156 383 [255]
157 384 $ hg tag -l fla
158 pretag hook: HG_HOOKNAME=pretag HG_HOOKTYPE=pretag HG_LOCAL=1 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=fla
159 pretag.forbid hook: HG_HOOKNAME=pretag.forbid HG_HOOKTYPE=pretag HG_LOCAL=1 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=fla
385 pretag hook: HG_HOOKNAME=pretag
386 HG_HOOKTYPE=pretag
387 HG_LOCAL=1
388 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10
389 HG_TAG=fla
390
391 pretag.forbid hook: HG_HOOKNAME=pretag.forbid
392 HG_HOOKTYPE=pretag
393 HG_LOCAL=1
394 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10
395 HG_TAG=fla
396
160 397 abort: pretag.forbid hook exited with status 1
161 398 [255]
162 399
@@ -165,22 +402,43 b' more there after'
165 402
166 403 $ cat >> .hg/hgrc <<EOF
167 404 > pretxncommit.forbid0 = sh -c "hg tip -q"
168 > pretxncommit.forbid1 = sh -c "printenv.py pretxncommit.forbid 1"
405 > pretxncommit.forbid1 = sh -c "printenv.py --line pretxncommit.forbid 1"
169 406 > EOF
170 407 $ echo z > z
171 408 $ hg add z
172 409 $ hg -q tip
173 410 4:539e4b31b6dc
174 411 $ hg commit -m 'fail' -d '4 0'
175 precommit hook: HG_HOOKNAME=precommit HG_HOOKTYPE=precommit HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10
176 pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=commit
177 pretxncommit hook: HG_HOOKNAME=pretxncommit HG_HOOKTYPE=pretxncommit HG_NODE=6f611f8018c10e827fee6bd2bc807f937e761567 HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PENDING=$TESTTMP/a
412 precommit hook: HG_HOOKNAME=precommit
413 HG_HOOKTYPE=precommit
414 HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10
415
416 pretxnopen hook: HG_HOOKNAME=pretxnopen
417 HG_HOOKTYPE=pretxnopen
418 HG_TXNID=TXN:$ID$
419 HG_TXNNAME=commit
420
421 pretxncommit hook: HG_HOOKNAME=pretxncommit
422 HG_HOOKTYPE=pretxncommit
423 HG_NODE=6f611f8018c10e827fee6bd2bc807f937e761567
424 HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10
425 HG_PENDING=$TESTTMP/a
426
178 427 5:6f611f8018c1
179 428 5:6f611f8018c1
180 pretxncommit.forbid hook: HG_HOOKNAME=pretxncommit.forbid1 HG_HOOKTYPE=pretxncommit HG_NODE=6f611f8018c10e827fee6bd2bc807f937e761567 HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PENDING=$TESTTMP/a
429 pretxncommit.forbid hook: HG_HOOKNAME=pretxncommit.forbid1
430 HG_HOOKTYPE=pretxncommit
431 HG_NODE=6f611f8018c10e827fee6bd2bc807f937e761567
432 HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10
433 HG_PENDING=$TESTTMP/a
434
181 435 transaction abort!
182 436 txnabort Python hook: txnid,txnname
183 txnabort hook: HG_HOOKNAME=txnabort.1 HG_HOOKTYPE=txnabort HG_TXNID=TXN:$ID$ HG_TXNNAME=commit
437 txnabort hook: HG_HOOKNAME=txnabort.1
438 HG_HOOKTYPE=txnabort
439 HG_TXNID=TXN:$ID$
440 HG_TXNNAME=commit
441
184 442 rollback completed
185 443 abort: pretxncommit.forbid1 hook exited with status 1
186 444 [255]
@@ -205,11 +463,17 b' more there after'
205 463 precommit hook can prevent commit
206 464
207 465 $ cat >> .hg/hgrc <<EOF
208 > precommit.forbid = sh -c "printenv.py precommit.forbid 1"
466 > precommit.forbid = sh -c "printenv.py --line precommit.forbid 1"
209 467 > EOF
210 468 $ hg commit -m 'fail' -d '4 0'
211 precommit hook: HG_HOOKNAME=precommit HG_HOOKTYPE=precommit HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10
212 precommit.forbid hook: HG_HOOKNAME=precommit.forbid HG_HOOKTYPE=precommit HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10
469 precommit hook: HG_HOOKNAME=precommit
470 HG_HOOKTYPE=precommit
471 HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10
472
473 precommit.forbid hook: HG_HOOKNAME=precommit.forbid
474 HG_HOOKTYPE=precommit
475 HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10
476
213 477 abort: precommit.forbid hook exited with status 1
214 478 [255]
215 479 $ hg -q tip
@@ -218,26 +482,36 b' precommit hook can prevent commit'
218 482 preupdate hook can prevent update
219 483
220 484 $ cat >> .hg/hgrc <<EOF
221 > preupdate = sh -c "printenv.py preupdate"
485 > preupdate = sh -c "printenv.py --line preupdate"
222 486 > EOF
223 487 $ hg update 1
224 preupdate hook: HG_HOOKNAME=preupdate HG_HOOKTYPE=preupdate HG_PARENT1=ab228980c14d
488 preupdate hook: HG_HOOKNAME=preupdate
489 HG_HOOKTYPE=preupdate
490 HG_PARENT1=ab228980c14d
491
225 492 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
226 493
227 494 update hook
228 495
229 496 $ cat >> .hg/hgrc <<EOF
230 > update = sh -c "printenv.py update"
497 > update = sh -c "printenv.py --line update"
231 498 > EOF
232 499 $ hg update
233 preupdate hook: HG_HOOKNAME=preupdate HG_HOOKTYPE=preupdate HG_PARENT1=539e4b31b6dc
234 update hook: HG_ERROR=0 HG_HOOKNAME=update HG_HOOKTYPE=update HG_PARENT1=539e4b31b6dc
500 preupdate hook: HG_HOOKNAME=preupdate
501 HG_HOOKTYPE=preupdate
502 HG_PARENT1=539e4b31b6dc
503
504 update hook: HG_ERROR=0
505 HG_HOOKNAME=update
506 HG_HOOKTYPE=update
507 HG_PARENT1=539e4b31b6dc
508
235 509 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
236 510
237 511 pushkey hook
238 512
239 513 $ cat >> .hg/hgrc <<EOF
240 > pushkey = sh -c "printenv.py pushkey"
514 > pushkey = sh -c "printenv.py --line pushkey"
241 515 > EOF
242 516 $ cd ../b
243 517 $ hg bookmark -r null foo
@@ -245,10 +519,41 b' pushkey hook'
245 519 pushing to ../a
246 520 searching for changes
247 521 no changes found
248 pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=push
249 pretxnclose hook: HG_BOOKMARK_MOVED=1 HG_BUNDLE2=1 HG_HOOKNAME=pretxnclose HG_HOOKTYPE=pretxnclose HG_PENDING=$TESTTMP/a HG_SOURCE=push HG_TXNID=TXN:$ID$ HG_TXNNAME=push HG_URL=file:$TESTTMP/a
250 pushkey hook: HG_BUNDLE2=1 HG_HOOKNAME=pushkey HG_HOOKTYPE=pushkey HG_KEY=foo HG_NAMESPACE=bookmarks HG_NEW=0000000000000000000000000000000000000000 HG_PUSHKEYCOMPAT=1 HG_SOURCE=push HG_TXNID=TXN:$ID$ HG_URL=file:$TESTTMP/a
251 txnclose hook: HG_BOOKMARK_MOVED=1 HG_BUNDLE2=1 HG_HOOKNAME=txnclose HG_HOOKTYPE=txnclose HG_SOURCE=push HG_TXNID=TXN:$ID$ HG_TXNNAME=push HG_URL=file:$TESTTMP/a
522 pretxnopen hook: HG_HOOKNAME=pretxnopen
523 HG_HOOKTYPE=pretxnopen
524 HG_TXNID=TXN:$ID$
525 HG_TXNNAME=push
526
527 pretxnclose hook: HG_BOOKMARK_MOVED=1
528 HG_BUNDLE2=1
529 HG_HOOKNAME=pretxnclose
530 HG_HOOKTYPE=pretxnclose
531 HG_PENDING=$TESTTMP/a
532 HG_SOURCE=push
533 HG_TXNID=TXN:$ID$
534 HG_TXNNAME=push
535 HG_URL=file:$TESTTMP/a
536
537 pushkey hook: HG_BUNDLE2=1
538 HG_HOOKNAME=pushkey
539 HG_HOOKTYPE=pushkey
540 HG_KEY=foo
541 HG_NAMESPACE=bookmarks
542 HG_NEW=0000000000000000000000000000000000000000
543 HG_PUSHKEYCOMPAT=1
544 HG_SOURCE=push
545 HG_TXNID=TXN:$ID$
546 HG_URL=file:$TESTTMP/a
547
548 txnclose hook: HG_BOOKMARK_MOVED=1
549 HG_BUNDLE2=1
550 HG_HOOKNAME=txnclose
551 HG_HOOKTYPE=txnclose
552 HG_SOURCE=push
553 HG_TXNID=TXN:$ID$
554 HG_TXNNAME=push
555 HG_URL=file:$TESTTMP/a
556
252 557 exporting bookmark foo
253 558 [1]
254 559 $ cd ../a
@@ -256,16 +561,35 b' pushkey hook'
256 561 listkeys hook
257 562
258 563 $ cat >> .hg/hgrc <<EOF
259 > listkeys = sh -c "printenv.py listkeys"
564 > listkeys = sh -c "printenv.py --line listkeys"
260 565 > EOF
261 566 $ hg bookmark -r null bar
262 pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=bookmark
263 pretxnclose hook: HG_BOOKMARK_MOVED=1 HG_HOOKNAME=pretxnclose HG_HOOKTYPE=pretxnclose HG_PENDING=$TESTTMP/a HG_TXNID=TXN:$ID$ HG_TXNNAME=bookmark
264 txnclose hook: HG_BOOKMARK_MOVED=1 HG_HOOKNAME=txnclose HG_HOOKTYPE=txnclose HG_TXNID=TXN:$ID$ HG_TXNNAME=bookmark
567 pretxnopen hook: HG_HOOKNAME=pretxnopen
568 HG_HOOKTYPE=pretxnopen
569 HG_TXNID=TXN:$ID$
570 HG_TXNNAME=bookmark
571
572 pretxnclose hook: HG_BOOKMARK_MOVED=1
573 HG_HOOKNAME=pretxnclose
574 HG_HOOKTYPE=pretxnclose
575 HG_PENDING=$TESTTMP/a
576 HG_TXNID=TXN:$ID$
577 HG_TXNNAME=bookmark
578
579 txnclose hook: HG_BOOKMARK_MOVED=1
580 HG_HOOKNAME=txnclose
581 HG_HOOKTYPE=txnclose
582 HG_TXNID=TXN:$ID$
583 HG_TXNNAME=bookmark
584
265 585 $ cd ../b
266 586 $ hg pull -B bar ../a
267 587 pulling from ../a
268 listkeys hook: HG_HOOKNAME=listkeys HG_HOOKTYPE=listkeys HG_NAMESPACE=bookmarks HG_VALUES={'bar': '0000000000000000000000000000000000000000', 'foo': '0000000000000000000000000000000000000000'}
588 listkeys hook: HG_HOOKNAME=listkeys
589 HG_HOOKTYPE=listkeys
590 HG_NAMESPACE=bookmarks
591 HG_VALUES={'bar': '0000000000000000000000000000000000000000', 'foo': '0000000000000000000000000000000000000000'}
592
269 593 no changes found
270 594 adding remote bookmark bar
271 595 $ cd ../a
@@ -273,18 +597,40 b' listkeys hook'
273 597 test that prepushkey can prevent incoming keys
274 598
275 599 $ cat >> .hg/hgrc <<EOF
276 > prepushkey = sh -c "printenv.py prepushkey.forbid 1"
600 > prepushkey = sh -c "printenv.py --line prepushkey.forbid 1"
277 601 > EOF
278 602 $ cd ../b
279 603 $ hg bookmark -r null baz
280 604 $ hg push -B baz ../a
281 605 pushing to ../a
282 606 searching for changes
283 listkeys hook: HG_HOOKNAME=listkeys HG_HOOKTYPE=listkeys HG_NAMESPACE=phases HG_VALUES={'cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b': '1', 'publishing': 'True'}
284 listkeys hook: HG_HOOKNAME=listkeys HG_HOOKTYPE=listkeys HG_NAMESPACE=bookmarks HG_VALUES={'bar': '0000000000000000000000000000000000000000', 'foo': '0000000000000000000000000000000000000000'}
607 listkeys hook: HG_HOOKNAME=listkeys
608 HG_HOOKTYPE=listkeys
609 HG_NAMESPACE=phases
610 HG_VALUES={'cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b': '1', 'publishing': 'True'}
611
612 listkeys hook: HG_HOOKNAME=listkeys
613 HG_HOOKTYPE=listkeys
614 HG_NAMESPACE=bookmarks
615 HG_VALUES={'bar': '0000000000000000000000000000000000000000', 'foo': '0000000000000000000000000000000000000000'}
616
285 617 no changes found
286 pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=push
287 prepushkey.forbid hook: HG_BUNDLE2=1 HG_HOOKNAME=prepushkey HG_HOOKTYPE=prepushkey HG_KEY=baz HG_NAMESPACE=bookmarks HG_NEW=0000000000000000000000000000000000000000 HG_PUSHKEYCOMPAT=1 HG_SOURCE=push HG_TXNID=TXN:$ID$ HG_URL=file:$TESTTMP/a
618 pretxnopen hook: HG_HOOKNAME=pretxnopen
619 HG_HOOKTYPE=pretxnopen
620 HG_TXNID=TXN:$ID$
621 HG_TXNNAME=push
622
623 prepushkey.forbid hook: HG_BUNDLE2=1
624 HG_HOOKNAME=prepushkey
625 HG_HOOKTYPE=prepushkey
626 HG_KEY=baz
627 HG_NAMESPACE=bookmarks
628 HG_NEW=0000000000000000000000000000000000000000
629 HG_PUSHKEYCOMPAT=1
630 HG_SOURCE=push
631 HG_TXNID=TXN:$ID$
632 HG_URL=file:$TESTTMP/a
633
288 634 abort: prepushkey hook exited with status 1
289 635 [255]
290 636 $ cd ../a
@@ -292,16 +638,34 b' test that prepushkey can prevent incomin'
292 638 test that prelistkeys can prevent listing keys
293 639
294 640 $ cat >> .hg/hgrc <<EOF
295 > prelistkeys = sh -c "printenv.py prelistkeys.forbid 1"
641 > prelistkeys = sh -c "printenv.py --line prelistkeys.forbid 1"
296 642 > EOF
297 643 $ hg bookmark -r null quux
298 pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=bookmark
299 pretxnclose hook: HG_BOOKMARK_MOVED=1 HG_HOOKNAME=pretxnclose HG_HOOKTYPE=pretxnclose HG_PENDING=$TESTTMP/a HG_TXNID=TXN:$ID$ HG_TXNNAME=bookmark
300 txnclose hook: HG_BOOKMARK_MOVED=1 HG_HOOKNAME=txnclose HG_HOOKTYPE=txnclose HG_TXNID=TXN:$ID$ HG_TXNNAME=bookmark
644 pretxnopen hook: HG_HOOKNAME=pretxnopen
645 HG_HOOKTYPE=pretxnopen
646 HG_TXNID=TXN:$ID$
647 HG_TXNNAME=bookmark
648
649 pretxnclose hook: HG_BOOKMARK_MOVED=1
650 HG_HOOKNAME=pretxnclose
651 HG_HOOKTYPE=pretxnclose
652 HG_PENDING=$TESTTMP/a
653 HG_TXNID=TXN:$ID$
654 HG_TXNNAME=bookmark
655
656 txnclose hook: HG_BOOKMARK_MOVED=1
657 HG_HOOKNAME=txnclose
658 HG_HOOKTYPE=txnclose
659 HG_TXNID=TXN:$ID$
660 HG_TXNNAME=bookmark
661
301 662 $ cd ../b
302 663 $ hg pull -B quux ../a
303 664 pulling from ../a
304 prelistkeys.forbid hook: HG_HOOKNAME=prelistkeys HG_HOOKTYPE=prelistkeys HG_NAMESPACE=bookmarks
665 prelistkeys.forbid hook: HG_HOOKNAME=prelistkeys
666 HG_HOOKTYPE=prelistkeys
667 HG_NAMESPACE=bookmarks
668
305 669 abort: prelistkeys hook exited with status 1
306 670 [255]
307 671 $ cd ../a
@@ -314,12 +678,17 b' prechangegroup hook can prevent incoming'
314 678 3:07f3376c1e65
315 679 $ cat > .hg/hgrc <<EOF
316 680 > [hooks]
317 > prechangegroup.forbid = sh -c "printenv.py prechangegroup.forbid 1"
681 > prechangegroup.forbid = sh -c "printenv.py --line prechangegroup.forbid 1"
318 682 > EOF
319 683 $ hg pull ../a
320 684 pulling from ../a
321 685 searching for changes
322 prechangegroup.forbid hook: HG_HOOKNAME=prechangegroup.forbid HG_HOOKTYPE=prechangegroup HG_SOURCE=pull HG_TXNID=TXN:$ID$ HG_URL=file:$TESTTMP/a
686 prechangegroup.forbid hook: HG_HOOKNAME=prechangegroup.forbid
687 HG_HOOKTYPE=prechangegroup
688 HG_SOURCE=pull
689 HG_TXNID=TXN:$ID$
690 HG_URL=file:$TESTTMP/a
691
323 692 abort: prechangegroup.forbid hook exited with status 1
324 693 [255]
325 694
@@ -329,7 +698,7 b' incoming changes no longer there after'
329 698 $ cat > .hg/hgrc <<EOF
330 699 > [hooks]
331 700 > pretxnchangegroup.forbid0 = hg tip -q
332 > pretxnchangegroup.forbid1 = sh -c "printenv.py pretxnchangegroup.forbid 1"
701 > pretxnchangegroup.forbid1 = sh -c "printenv.py --line pretxnchangegroup.forbid 1"
333 702 > EOF
334 703 $ hg pull ../a
335 704 pulling from ../a
@@ -339,7 +708,15 b' incoming changes no longer there after'
339 708 adding file changes
340 709 added 1 changesets with 1 changes to 1 files
341 710 4:539e4b31b6dc
342 pretxnchangegroup.forbid hook: HG_HOOKNAME=pretxnchangegroup.forbid1 HG_HOOKTYPE=pretxnchangegroup HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_NODE_LAST=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PENDING=$TESTTMP/b HG_SOURCE=pull HG_TXNID=TXN:$ID$ HG_URL=file:$TESTTMP/a
711 pretxnchangegroup.forbid hook: HG_HOOKNAME=pretxnchangegroup.forbid1
712 HG_HOOKTYPE=pretxnchangegroup
713 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10
714 HG_NODE_LAST=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10
715 HG_PENDING=$TESTTMP/b
716 HG_SOURCE=pull
717 HG_TXNID=TXN:$ID$
718 HG_URL=file:$TESTTMP/a
719
343 720 transaction abort!
344 721 rollback completed
345 722 abort: pretxnchangegroup.forbid1 hook exited with status 1
@@ -352,14 +729,21 b' outgoing hooks can see env vars'
352 729 $ rm .hg/hgrc
353 730 $ cat > ../a/.hg/hgrc <<EOF
354 731 > [hooks]
355 > preoutgoing = sh -c "printenv.py preoutgoing"
356 > outgoing = sh -c "printenv.py outgoing"
732 > preoutgoing = sh -c "printenv.py --line preoutgoing"
733 > outgoing = sh -c "printenv.py --line outgoing"
357 734 > EOF
358 735 $ hg pull ../a
359 736 pulling from ../a
360 737 searching for changes
361 preoutgoing hook: HG_HOOKNAME=preoutgoing HG_HOOKTYPE=preoutgoing HG_SOURCE=pull
362 outgoing hook: HG_HOOKNAME=outgoing HG_HOOKTYPE=outgoing HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_SOURCE=pull
738 preoutgoing hook: HG_HOOKNAME=preoutgoing
739 HG_HOOKTYPE=preoutgoing
740 HG_SOURCE=pull
741
742 outgoing hook: HG_HOOKNAME=outgoing
743 HG_HOOKTYPE=outgoing
744 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10
745 HG_SOURCE=pull
746
363 747 adding changesets
364 748 adding manifests
365 749 adding file changes
@@ -373,13 +757,19 b' outgoing hooks can see env vars'
373 757 preoutgoing hook can prevent outgoing changes
374 758
375 759 $ cat >> ../a/.hg/hgrc <<EOF
376 > preoutgoing.forbid = sh -c "printenv.py preoutgoing.forbid 1"
760 > preoutgoing.forbid = sh -c "printenv.py --line preoutgoing.forbid 1"
377 761 > EOF
378 762 $ hg pull ../a
379 763 pulling from ../a
380 764 searching for changes
381 preoutgoing hook: HG_HOOKNAME=preoutgoing HG_HOOKTYPE=preoutgoing HG_SOURCE=pull
382 preoutgoing.forbid hook: HG_HOOKNAME=preoutgoing.forbid HG_HOOKTYPE=preoutgoing HG_SOURCE=pull
765 preoutgoing hook: HG_HOOKNAME=preoutgoing
766 HG_HOOKTYPE=preoutgoing
767 HG_SOURCE=pull
768
769 preoutgoing.forbid hook: HG_HOOKNAME=preoutgoing.forbid
770 HG_HOOKTYPE=preoutgoing
771 HG_SOURCE=pull
772
383 773 abort: preoutgoing.forbid hook exited with status 1
384 774 [255]
385 775
@@ -388,12 +778,19 b' outgoing hooks work for local clones'
388 778 $ cd ..
389 779 $ cat > a/.hg/hgrc <<EOF
390 780 > [hooks]
391 > preoutgoing = sh -c "printenv.py preoutgoing"
392 > outgoing = sh -c "printenv.py outgoing"
781 > preoutgoing = sh -c "printenv.py --line preoutgoing"
782 > outgoing = sh -c "printenv.py --line outgoing"
393 783 > EOF
394 784 $ hg clone a c
395 preoutgoing hook: HG_HOOKNAME=preoutgoing HG_HOOKTYPE=preoutgoing HG_SOURCE=clone
396 outgoing hook: HG_HOOKNAME=outgoing HG_HOOKTYPE=outgoing HG_NODE=0000000000000000000000000000000000000000 HG_SOURCE=clone
785 preoutgoing hook: HG_HOOKNAME=preoutgoing
786 HG_HOOKTYPE=preoutgoing
787 HG_SOURCE=clone
788
789 outgoing hook: HG_HOOKNAME=outgoing
790 HG_HOOKTYPE=outgoing
791 HG_NODE=0000000000000000000000000000000000000000
792 HG_SOURCE=clone
793
397 794 updating to branch default
398 795 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
399 796 $ rm -rf c
@@ -401,11 +798,17 b' outgoing hooks work for local clones'
401 798 preoutgoing hook can prevent outgoing changes for local clones
402 799
403 800 $ cat >> a/.hg/hgrc <<EOF
404 > preoutgoing.forbid = sh -c "printenv.py preoutgoing.forbid 1"
801 > preoutgoing.forbid = sh -c "printenv.py --line preoutgoing.forbid 1"
405 802 > EOF
406 803 $ hg clone a zzz
407 preoutgoing hook: HG_HOOKNAME=preoutgoing HG_HOOKTYPE=preoutgoing HG_SOURCE=clone
408 preoutgoing.forbid hook: HG_HOOKNAME=preoutgoing.forbid HG_HOOKTYPE=preoutgoing HG_SOURCE=clone
804 preoutgoing hook: HG_HOOKNAME=preoutgoing
805 HG_HOOKTYPE=preoutgoing
806 HG_SOURCE=clone
807
808 preoutgoing.forbid hook: HG_HOOKNAME=preoutgoing.forbid
809 HG_HOOKTYPE=preoutgoing
810 HG_SOURCE=clone
811
409 812 abort: preoutgoing.forbid hook exited with status 1
410 813 [255]
411 814
@@ -780,10 +1183,16 b' This also creates the `to` repo for the '
780 1183 $ cd ..
781 1184 $ cat << EOF >> hgrc-with-post-init-hook
782 1185 > [hooks]
783 > post-init = sh -c "printenv.py post-init"
1186 > post-init = sh -c "printenv.py --line post-init"
784 1187 > EOF
785 1188 $ HGRCPATH=hgrc-with-post-init-hook hg init to
786 post-init hook: HG_ARGS=init to HG_HOOKNAME=post-init HG_HOOKTYPE=post-init HG_OPTS={'insecure': None, 'remotecmd': '', 'ssh': ''} HG_PATS=['to'] HG_RESULT=0
1189 post-init hook: HG_ARGS=init to
1190 HG_HOOKNAME=post-init
1191 HG_HOOKTYPE=post-init
1192 HG_OPTS={'insecure': None, 'remotecmd': '', 'ssh': ''}
1193 HG_PATS=['to']
1194 HG_RESULT=0
1195
787 1196
788 1197 new commits must be visible in pretxnchangegroup (issue3428)
789 1198
General Comments 0
You need to be logged in to leave comments. Login now