Show More
@@ -216,8 +216,10 b" Make sure bundlerepo doesn't leak tempfi" | |||
|
216 | 216 | |
|
217 | 217 | Pull ../full.hg into empty (with hook) |
|
218 | 218 | |
|
219 |
$ |
|
|
220 | $ echo "changegroup = printenv.py changegroup" >> .hg/hgrc | |
|
219 | $ cat >> .hg/hgrc <<EOF | |
|
220 | > [hooks] | |
|
221 | > changegroup = sh -c "printenv.py changegroup" | |
|
222 | > EOF | |
|
221 | 223 | |
|
222 | 224 | doesn't work (yet ?) |
|
223 | 225 |
@@ -16,9 +16,9 b' commit hooks can see env vars' | |||
|
16 | 16 | > precommit = sh -c "HG_LOCAL= HG_NODE= HG_TAG= printenv.py precommit" |
|
17 | 17 | > pretxncommit = sh -c "HG_LOCAL= HG_TAG= printenv.py pretxncommit" |
|
18 | 18 | > pretxncommit.tip = hg -q tip |
|
19 |
> pre-identify = |
|
|
20 |
> pre-cat = |
|
|
21 |
> post-cat = |
|
|
19 | > pre-identify = sh -c "printenv.py pre-identify 1" | |
|
20 | > pre-cat = sh -c "printenv.py pre-cat" | |
|
21 | > post-cat = sh -c "printenv.py post-cat" | |
|
22 | 22 | > pretxnopen = sh -c "HG_LOCAL= HG_TAG= printenv.py pretxnopen" |
|
23 | 23 | > pretxnclose = sh -c "HG_LOCAL= HG_TAG= printenv.py pretxnclose" |
|
24 | 24 | > txnclose = sh -c "HG_LOCAL= HG_TAG= printenv.py txnclose" |
@@ -47,9 +47,9 b' changegroup hooks can see env vars' | |||
|
47 | 47 | |
|
48 | 48 | $ cat > .hg/hgrc <<EOF |
|
49 | 49 | > [hooks] |
|
50 |
> prechangegroup = |
|
|
51 |
> changegroup = |
|
|
52 |
> incoming = |
|
|
50 | > prechangegroup = sh -c "printenv.py prechangegroup" | |
|
51 | > changegroup = sh -c "printenv.py changegroup" | |
|
52 | > incoming = sh -c "printenv.py incoming" | |
|
53 | 53 | > EOF |
|
54 | 54 | |
|
55 | 55 | pretxncommit and commit hooks can see both parents of merge |
@@ -122,7 +122,7 b' tag hooks can see env vars' | |||
|
122 | 122 | |
|
123 | 123 | $ cd ../a |
|
124 | 124 | $ cat >> .hg/hgrc <<EOF |
|
125 |
> pretag = |
|
|
125 | > pretag = sh -c "printenv.py pretag" | |
|
126 | 126 | > tag = sh -c "HG_PARENT1= HG_PARENT2= printenv.py tag" |
|
127 | 127 | > EOF |
|
128 | 128 | $ hg tag -d '3 0' a |
@@ -142,7 +142,9 b' tag hooks can see env vars' | |||
|
142 | 142 | |
|
143 | 143 | pretag hook can forbid tagging |
|
144 | 144 | |
|
145 | $ echo "pretag.forbid = printenv.py pretag.forbid 1" >> .hg/hgrc | |
|
145 | $ cat >> .hg/hgrc <<EOF | |
|
146 | > pretag.forbid = sh -c "printenv.py pretag.forbid 1" | |
|
147 | > EOF | |
|
146 | 148 |
$ hg tag -d '4 |
|
147 | 149 | pretag hook: HG_LOCAL=0 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=fa |
|
148 | 150 | pretag.forbid hook: HG_LOCAL=0 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=fa |
@@ -157,8 +159,10 b' pretag hook can forbid tagging' | |||
|
157 | 159 | pretxncommit hook can see changeset, can roll back txn, changeset no |
|
158 | 160 | more there after |
|
159 | 161 | |
|
160 | $ echo "pretxncommit.forbid0 = hg tip -q" >> .hg/hgrc | |
|
161 | $ echo "pretxncommit.forbid1 = printenv.py pretxncommit.forbid 1" >> .hg/hgrc | |
|
162 | $ cat >> .hg/hgrc <<EOF | |
|
163 | > pretxncommit.forbid0 = sh -c "hg tip -q" | |
|
164 | > pretxncommit.forbid1 = sh -c "printenv.py pretxncommit.forbid 1" | |
|
165 | > EOF | |
|
162 | 166 | $ echo z > z |
|
163 | 167 | $ hg add z |
|
164 | 168 | $ hg -q tip |
@@ -196,7 +200,9 b' more there after' | |||
|
196 | 200 | |
|
197 | 201 | precommit hook can prevent commit |
|
198 | 202 | |
|
199 | $ echo "precommit.forbid = printenv.py precommit.forbid 1" >> .hg/hgrc | |
|
203 | $ cat >> .hg/hgrc <<EOF | |
|
204 | > precommit.forbid = sh -c "printenv.py precommit.forbid 1" | |
|
205 | > EOF | |
|
200 | 206 | $ hg commit -m 'fail' -d '4 0' |
|
201 | 207 | precommit hook: HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 |
|
202 | 208 | precommit.forbid hook: HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 |
@@ -207,14 +213,18 b' precommit hook can prevent commit' | |||
|
207 | 213 | |
|
208 | 214 | preupdate hook can prevent update |
|
209 | 215 | |
|
210 | $ echo "preupdate = printenv.py preupdate" >> .hg/hgrc | |
|
216 | $ cat >> .hg/hgrc <<EOF | |
|
217 | > preupdate = sh -c "printenv.py preupdate" | |
|
218 | > EOF | |
|
211 | 219 | $ hg update 1 |
|
212 | 220 | preupdate hook: HG_PARENT1=ab228980c14d |
|
213 | 221 | 0 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
214 | 222 | |
|
215 | 223 | update hook |
|
216 | 224 | |
|
217 | $ echo "update = printenv.py update" >> .hg/hgrc | |
|
225 | $ cat >> .hg/hgrc <<EOF | |
|
226 | > update = sh -c "printenv.py update" | |
|
227 | > EOF | |
|
218 | 228 | $ hg update |
|
219 | 229 | preupdate hook: HG_PARENT1=539e4b31b6dc |
|
220 | 230 | update hook: HG_ERROR=0 HG_PARENT1=539e4b31b6dc |
@@ -222,7 +232,9 b' update hook' | |||
|
222 | 232 | |
|
223 | 233 | pushkey hook |
|
224 | 234 | |
|
225 | $ echo "pushkey = printenv.py pushkey" >> .hg/hgrc | |
|
235 | $ cat >> .hg/hgrc <<EOF | |
|
236 | > pushkey = sh -c "printenv.py pushkey" | |
|
237 | > EOF | |
|
226 | 238 | $ cd ../b |
|
227 | 239 | $ hg bookmark -r null foo |
|
228 | 240 | $ hg push -B foo ../a |
@@ -239,7 +251,9 b' pushkey hook' | |||
|
239 | 251 | |
|
240 | 252 | listkeys hook |
|
241 | 253 | |
|
242 | $ echo "listkeys = printenv.py listkeys" >> .hg/hgrc | |
|
254 | $ cat >> .hg/hgrc <<EOF | |
|
255 | > listkeys = sh -c "printenv.py listkeys" | |
|
256 | > EOF | |
|
243 | 257 | $ hg bookmark -r null bar |
|
244 | 258 | pretxnopen hook: HG_TXNID=TXN:* HG_TXNNAME=bookmark (glob) |
|
245 | 259 | pretxnclose hook: HG_BOOKMARK_MOVED=1 HG_PENDING=$TESTTMP/a HG_TXNID=TXN:* HG_TXNNAME=bookmark (glob) |
@@ -255,7 +269,9 b' listkeys hook' | |||
|
255 | 269 | |
|
256 | 270 | test that prepushkey can prevent incoming keys |
|
257 | 271 | |
|
258 | $ echo "prepushkey = printenv.py prepushkey.forbid 1" >> .hg/hgrc | |
|
272 | $ cat >> .hg/hgrc <<EOF | |
|
273 | > prepushkey = sh -c "printenv.py prepushkey.forbid 1" | |
|
274 | > EOF | |
|
259 | 275 | $ cd ../b |
|
260 | 276 | $ hg bookmark -r null baz |
|
261 | 277 | $ hg push -B baz ../a |
@@ -273,7 +289,9 b' test that prepushkey can prevent incomin' | |||
|
273 | 289 | |
|
274 | 290 | test that prelistkeys can prevent listing keys |
|
275 | 291 | |
|
276 | $ echo "prelistkeys = printenv.py prelistkeys.forbid 1" >> .hg/hgrc | |
|
292 | $ cat >> .hg/hgrc <<EOF | |
|
293 | > prelistkeys = sh -c "printenv.py prelistkeys.forbid 1" | |
|
294 | > EOF | |
|
277 | 295 | $ hg bookmark -r null quux |
|
278 | 296 | pretxnopen hook: HG_TXNID=TXN:* HG_TXNNAME=bookmark (glob) |
|
279 | 297 | pretxnclose hook: HG_BOOKMARK_MOVED=1 HG_PENDING=$TESTTMP/a HG_TXNID=TXN:* HG_TXNNAME=bookmark (glob) |
@@ -294,7 +312,7 b' prechangegroup hook can prevent incoming' | |||
|
294 | 312 | 3:07f3376c1e65 |
|
295 | 313 | $ cat > .hg/hgrc <<EOF |
|
296 | 314 | > [hooks] |
|
297 |
> prechangegroup.forbid = |
|
|
315 | > prechangegroup.forbid = sh -c "printenv.py prechangegroup.forbid 1" | |
|
298 | 316 | > EOF |
|
299 | 317 | $ hg pull ../a |
|
300 | 318 | pulling from ../a |
@@ -309,7 +327,7 b' incoming changes no longer there after' | |||
|
309 | 327 | $ cat > .hg/hgrc <<EOF |
|
310 | 328 | > [hooks] |
|
311 | 329 | > pretxnchangegroup.forbid0 = hg tip -q |
|
312 |
> pretxnchangegroup.forbid1 = |
|
|
330 | > pretxnchangegroup.forbid1 = sh -c "printenv.py pretxnchangegroup.forbid 1" | |
|
313 | 331 | > EOF |
|
314 | 332 | $ hg pull ../a |
|
315 | 333 | pulling from ../a |
@@ -332,8 +350,8 b' outgoing hooks can see env vars' | |||
|
332 | 350 | $ rm .hg/hgrc |
|
333 | 351 | $ cat > ../a/.hg/hgrc <<EOF |
|
334 | 352 | > [hooks] |
|
335 |
> preoutgoing = |
|
|
336 |
> outgoing = |
|
|
353 | > preoutgoing = sh -c "printenv.py preoutgoing" | |
|
354 | > outgoing = sh -c "printenv.py outgoing" | |
|
337 | 355 | > EOF |
|
338 | 356 | $ hg pull ../a |
|
339 | 357 | pulling from ../a |
@@ -351,7 +369,9 b' outgoing hooks can see env vars' | |||
|
351 | 369 | |
|
352 | 370 | preoutgoing hook can prevent outgoing changes |
|
353 | 371 | |
|
354 | $ echo "preoutgoing.forbid = printenv.py preoutgoing.forbid 1" >> ../a/.hg/hgrc | |
|
372 | $ cat >> ../a/.hg/hgrc <<EOF | |
|
373 | > preoutgoing.forbid = sh -c "printenv.py preoutgoing.forbid 1" | |
|
374 | > EOF | |
|
355 | 375 | $ hg pull ../a |
|
356 | 376 | pulling from ../a |
|
357 | 377 | searching for changes |
@@ -365,8 +385,8 b' outgoing hooks work for local clones' | |||
|
365 | 385 | $ cd .. |
|
366 | 386 | $ cat > a/.hg/hgrc <<EOF |
|
367 | 387 | > [hooks] |
|
368 |
> preoutgoing = |
|
|
369 |
> outgoing = |
|
|
388 | > preoutgoing = sh -c "printenv.py preoutgoing" | |
|
389 | > outgoing = sh -c "printenv.py outgoing" | |
|
370 | 390 | > EOF |
|
371 | 391 | $ hg clone a c |
|
372 | 392 | preoutgoing hook: HG_SOURCE=clone |
@@ -377,7 +397,9 b' outgoing hooks work for local clones' | |||
|
377 | 397 | |
|
378 | 398 | preoutgoing hook can prevent outgoing changes for local clones |
|
379 | 399 | |
|
380 | $ echo "preoutgoing.forbid = printenv.py preoutgoing.forbid 1" >> a/.hg/hgrc | |
|
400 | $ cat >> a/.hg/hgrc <<EOF | |
|
401 | > preoutgoing.forbid = sh -c "printenv.py preoutgoing.forbid 1" | |
|
402 | > EOF | |
|
381 | 403 | $ hg clone a zzz |
|
382 | 404 | preoutgoing hook: HG_SOURCE=clone |
|
383 | 405 | preoutgoing.forbid hook: HG_SOURCE=clone |
@@ -750,7 +772,7 b' This also creates the `to` repo for the ' | |||
|
750 | 772 | $ cd .. |
|
751 | 773 | $ cat << EOF >> hgrc-with-post-init-hook |
|
752 | 774 | > [hooks] |
|
753 | > post-init = printenv.py post-init | |
|
775 | > post-init = sh -c "printenv.py post-init" | |
|
754 | 776 | > EOF |
|
755 | 777 | $ HGRCPATH=hgrc-with-post-init-hook hg init to |
|
756 | 778 | post-init hook: HG_ARGS=init to HG_OPTS={'insecure': None, 'remotecmd': '', 'ssh': ''} HG_PATS=['to'] HG_RESULT=0 |
@@ -127,8 +127,10 b' incoming via HTTP' | |||
|
127 | 127 | pull |
|
128 | 128 | |
|
129 | 129 | $ cd copy-pull |
|
130 |
$ |
|
|
131 | $ echo "changegroup = printenv.py changegroup" >> .hg/hgrc | |
|
130 | $ cat >> .hg/hgrc <<EOF | |
|
131 | > [hooks] | |
|
132 | > changegroup = sh -c "printenv.py changegroup" | |
|
133 | > EOF | |
|
132 | 134 | $ hg pull |
|
133 | 135 | pulling from http://localhost:$HGPORT1/ |
|
134 | 136 | searching for changes |
@@ -118,8 +118,10 b' incoming via HTTP' | |||
|
118 | 118 | pull |
|
119 | 119 | |
|
120 | 120 | $ cd copy-pull |
|
121 |
$ |
|
|
122 | $ echo "changegroup = printenv.py changegroup" >> .hg/hgrc | |
|
121 | $ cat >> .hg/hgrc <<EOF | |
|
122 | > [hooks] | |
|
123 | > changegroup = sh -c "printenv.py changegroup" | |
|
124 | > EOF | |
|
123 | 125 | $ hg pull |
|
124 | 126 | pulling from http://localhost:$HGPORT1/ |
|
125 | 127 | searching for changes |
@@ -203,8 +203,10 b' Inability to verify peer certificate wil' | |||
|
203 | 203 | pull without cacert |
|
204 | 204 | |
|
205 | 205 | $ cd copy-pull |
|
206 |
$ |
|
|
207 | $ echo "changegroup = printenv.py changegroup" >> .hg/hgrc | |
|
206 | $ cat >> .hg/hgrc <<EOF | |
|
207 | > [hooks] | |
|
208 | > changegroup = sh -c "printenv.py changegroup" | |
|
209 | > EOF | |
|
208 | 210 | $ hg pull $DISABLECACERTS |
|
209 | 211 | pulling from https://localhost:$HGPORT/ |
|
210 | 212 | warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?) |
@@ -66,10 +66,12 b' expect authorization error: must have au' | |||
|
66 | 66 | |
|
67 | 67 | expect success |
|
68 | 68 | |
|
69 | $ echo 'allow_push = *' >> .hg/hgrc | |
|
70 | $ echo '[hooks]' >> .hg/hgrc | |
|
71 | $ echo "changegroup = printenv.py changegroup 0" >> .hg/hgrc | |
|
72 | $ echo "pushkey = printenv.py pushkey 0" >> .hg/hgrc | |
|
69 | $ cat >> .hg/hgrc <<EOF | |
|
70 | > allow_push = * | |
|
71 | > [hooks] | |
|
72 | > changegroup = sh -c "printenv.py changegroup 0" | |
|
73 | > pushkey = sh -c "printenv.py pushkey 0" | |
|
74 | > EOF | |
|
73 | 75 | $ req |
|
74 | 76 | pushing to http://localhost:$HGPORT/ |
|
75 | 77 | searching for changes |
@@ -151,7 +153,7 b' expect push success, phase change failur' | |||
|
151 | 153 | > push_ssl = false |
|
152 | 154 | > allow_push = * |
|
153 | 155 | > [hooks] |
|
154 |
> prepushkey = |
|
|
156 | > prepushkey = sh -c "printenv.py prepushkey 1" | |
|
155 | 157 | > EOF |
|
156 | 158 | $ req |
|
157 | 159 | pushing to http://localhost:$HGPORT/ |
@@ -164,7 +166,9 b' expect push success, phase change failur' | |||
|
164 | 166 | |
|
165 | 167 | expect phase change success |
|
166 | 168 | |
|
167 | $ echo "prepushkey = printenv.py prepushkey 0" >> .hg/hgrc | |
|
169 | $ cat >> .hg/hgrc <<EOF | |
|
170 | > prepushkey = sh -c "printenv.py prepushkey 0" | |
|
171 | > EOF | |
|
168 | 172 | $ req |
|
169 | 173 | pushing to http://localhost:$HGPORT/ |
|
170 | 174 | searching for changes |
@@ -56,10 +56,12 b' expect authorization error: must have au' | |||
|
56 | 56 | |
|
57 | 57 | expect success |
|
58 | 58 | |
|
59 | $ echo 'allow_push = *' >> .hg/hgrc | |
|
60 | $ echo '[hooks]' >> .hg/hgrc | |
|
61 | $ echo "changegroup = printenv.py changegroup 0" >> .hg/hgrc | |
|
62 | $ echo "pushkey = printenv.py pushkey 0" >> .hg/hgrc | |
|
59 | $ cat >> .hg/hgrc <<EOF | |
|
60 | > allow_push = * | |
|
61 | > [hooks] | |
|
62 | > changegroup = sh -c "printenv.py changegroup 0" | |
|
63 | > pushkey = sh -c "printenv.py pushkey 0" | |
|
64 | > EOF | |
|
63 | 65 | $ req |
|
64 | 66 | pushing to http://localhost:$HGPORT/ |
|
65 | 67 | searching for changes |
@@ -114,7 +116,7 b' expect push success, phase change failur' | |||
|
114 | 116 | > push_ssl = false |
|
115 | 117 | > allow_push = * |
|
116 | 118 | > [hooks] |
|
117 |
> prepushkey = |
|
|
119 | > prepushkey = sh -c "printenv.py prepushkey 1" | |
|
118 | 120 | > EOF |
|
119 | 121 | $ req |
|
120 | 122 | pushing to http://localhost:$HGPORT/ |
@@ -133,7 +135,9 b' expect push success, phase change failur' | |||
|
133 | 135 | |
|
134 | 136 | expect phase change success |
|
135 | 137 | |
|
136 | $ echo "prepushkey = printenv.py prepushkey 0" >> .hg/hgrc | |
|
138 | $ cat >> .hg/hgrc <<EOF | |
|
139 | > prepushkey = sh -c "printenv.py prepushkey 0" | |
|
140 | > EOF | |
|
137 | 141 | $ req |
|
138 | 142 | pushing to http://localhost:$HGPORT/ |
|
139 | 143 | searching for changes |
@@ -38,7 +38,7 b' configure for serving' | |||
|
38 | 38 | > uncompressed = True |
|
39 | 39 | > |
|
40 | 40 | > [hooks] |
|
41 |
> changegroup = |
|
|
41 | > changegroup = sh -c "printenv.py changegroup-in-remote 0 ../dummylog" | |
|
42 | 42 | > EOF |
|
43 | 43 | $ cd .. |
|
44 | 44 | |
@@ -114,8 +114,10 b' verify' | |||
|
114 | 114 | crosschecking files in changesets and manifests |
|
115 | 115 | checking files |
|
116 | 116 | 2 files, 3 changesets, 2 total revisions |
|
117 |
$ |
|
|
118 | $ echo "changegroup = printenv.py changegroup-in-local 0 ../dummylog" >> .hg/hgrc | |
|
117 | $ cat >> .hg/hgrc <<EOF | |
|
118 | > [hooks] | |
|
119 | > changegroup = sh -c "printenv.py changegroup-in-local 0 ../dummylog" | |
|
120 | > EOF | |
|
119 | 121 | |
|
120 | 122 | empty default pull |
|
121 | 123 |
@@ -32,7 +32,7 b' configure for serving' | |||
|
32 | 32 | > uncompressed = True |
|
33 | 33 | > |
|
34 | 34 | > [hooks] |
|
35 |
> changegroup = |
|
|
35 | > changegroup = sh -c "printenv.py changegroup-in-remote 0 ../dummylog" | |
|
36 | 36 | > EOF |
|
37 | 37 | $ cd .. |
|
38 | 38 | |
@@ -108,8 +108,10 b' verify' | |||
|
108 | 108 | crosschecking files in changesets and manifests |
|
109 | 109 | checking files |
|
110 | 110 | 2 files, 3 changesets, 2 total revisions |
|
111 |
$ |
|
|
112 | $ echo "changegroup = printenv.py changegroup-in-local 0 ../dummylog" >> .hg/hgrc | |
|
111 | $ cat >> .hg/hgrc <<EOF | |
|
112 | > [hooks] | |
|
113 | > changegroup = sh -c "printenv.py changegroup-in-local 0 ../dummylog" | |
|
114 | > EOF | |
|
113 | 115 | |
|
114 | 116 | empty default pull |
|
115 | 117 |
@@ -53,8 +53,10 b' check for HTTP opener failures when cach' | |||
|
53 | 53 | |
|
54 | 54 | $ rm .hg/cache/* |
|
55 | 55 | $ cd ../local |
|
56 |
$ |
|
|
57 | $ echo "changegroup = printenv.py changegroup" >> .hg/hgrc | |
|
56 | $ cat >> .hg/hgrc <<EOF | |
|
57 | > [hooks] | |
|
58 | > changegroup = sh -c "printenv.py changegroup" | |
|
59 | > EOF | |
|
58 | 60 | $ hg pull |
|
59 | 61 | pulling from static-http://localhost:$HGPORT/remote |
|
60 | 62 | searching for changes |
General Comments 0
You need to be logged in to leave comments.
Login now