Show More
@@ -1,12 +1,9 b'' | |||
|
1 | 1 | # simple script to be used in hooks |
|
2 | # copy it to the current directory when the test starts: | |
|
3 | # | |
|
4 | # cp "$TESTDIR"/printenv.py . | |
|
5 | 2 | # |
|
6 | 3 | # put something like this in the repo .hg/hgrc: |
|
7 | 4 | # |
|
8 | 5 | # [hooks] |
|
9 |
# changegroup = python |
|
|
6 | # changegroup = python "$TESTDIR"/printenv.py <hookname> [exit] [output] | |
|
10 | 7 | # |
|
11 | 8 | # - <hookname> is a mandatory argument (e.g. "changegroup") |
|
12 | 9 | # - [exit] is the exit code of the hook (default: 0) |
@@ -1,5 +1,3 b'' | |||
|
1 | $ cp "$TESTDIR"/printenv.py . | |
|
2 | ||
|
3 | 1 | Setting up test |
|
4 | 2 | |
|
5 | 3 | $ hg init test |
@@ -199,7 +197,7 b" Make sure bundlerepo doesn't leak tempfi" | |||
|
199 | 197 | Pull ../full.hg into empty (with hook) |
|
200 | 198 | |
|
201 | 199 | $ echo '[hooks]' >> .hg/hgrc |
|
202 |
$ echo 'changegroup = python |
|
|
200 | $ echo 'changegroup = python "$TESTDIR"/printenv.py changegroup' >> .hg/hgrc | |
|
203 | 201 | |
|
204 | 202 | doesn't work (yet ?) |
|
205 | 203 |
@@ -1,18 +1,16 b'' | |||
|
1 | $ cp "$TESTDIR"/printenv.py . | |
|
2 | ||
|
3 | 1 | commit hooks can see env vars |
|
4 | 2 | |
|
5 | 3 | $ hg init a |
|
6 | 4 | $ cd a |
|
7 | 5 | $ echo "[hooks]" > .hg/hgrc |
|
8 |
$ echo 'commit = unset HG_LOCAL HG_TAG; python |
|
|
9 |
$ echo 'commit.b = unset HG_LOCAL HG_TAG; python |
|
|
10 |
$ echo 'precommit = unset HG_LOCAL HG_NODE HG_TAG; python |
|
|
11 |
$ echo 'pretxncommit = unset HG_LOCAL HG_TAG; python |
|
|
6 | $ echo 'commit = unset HG_LOCAL HG_TAG; python "$TESTDIR"/printenv.py commit' >> .hg/hgrc | |
|
7 | $ echo 'commit.b = unset HG_LOCAL HG_TAG; python "$TESTDIR"/printenv.py commit.b' >> .hg/hgrc | |
|
8 | $ echo 'precommit = unset HG_LOCAL HG_NODE HG_TAG; python "$TESTDIR"/printenv.py precommit' >> .hg/hgrc | |
|
9 | $ echo 'pretxncommit = unset HG_LOCAL HG_TAG; python "$TESTDIR"/printenv.py pretxncommit' >> .hg/hgrc | |
|
12 | 10 | $ echo 'pretxncommit.tip = hg -q tip' >> .hg/hgrc |
|
13 |
$ echo 'pre-identify = python |
|
|
14 |
$ echo 'pre-cat = python |
|
|
15 |
$ echo 'post-cat = python |
|
|
11 | $ echo 'pre-identify = python "$TESTDIR"/printenv.py pre-identify 1' >> .hg/hgrc | |
|
12 | $ echo 'pre-cat = python "$TESTDIR"/printenv.py pre-cat' >> .hg/hgrc | |
|
13 | $ echo 'post-cat = python "$TESTDIR"/printenv.py post-cat' >> .hg/hgrc | |
|
16 | 14 | $ echo a > a |
|
17 | 15 | $ hg add a |
|
18 | 16 | $ hg commit -m a |
@@ -30,9 +28,9 b' commit hooks can see env vars' | |||
|
30 | 28 | changegroup hooks can see env vars |
|
31 | 29 | |
|
32 | 30 | $ echo '[hooks]' > .hg/hgrc |
|
33 |
$ echo 'prechangegroup = python |
|
|
34 |
$ echo 'changegroup = python |
|
|
35 |
$ echo 'incoming = python |
|
|
31 | $ echo 'prechangegroup = python "$TESTDIR"/printenv.py prechangegroup' >> .hg/hgrc | |
|
32 | $ echo 'changegroup = python "$TESTDIR"/printenv.py changegroup' >> .hg/hgrc | |
|
33 | $ echo 'incoming = python "$TESTDIR"/printenv.py incoming' >> .hg/hgrc | |
|
36 | 34 | |
|
37 | 35 | pretxncommit and commit hooks can see both parents of merge |
|
38 | 36 | |
@@ -94,8 +92,8 b' test generic hooks' | |||
|
94 | 92 | tag hooks can see env vars |
|
95 | 93 | |
|
96 | 94 | $ cd ../a |
|
97 |
$ echo 'pretag = python |
|
|
98 |
$ echo 'tag = unset HG_PARENT1 HG_PARENT2; python |
|
|
95 | $ echo 'pretag = python "$TESTDIR"/printenv.py pretag' >> .hg/hgrc | |
|
96 | $ echo 'tag = unset HG_PARENT1 HG_PARENT2; python "$TESTDIR"/printenv.py tag' >> .hg/hgrc | |
|
99 | 97 | $ hg tag -d '3 0' a |
|
100 | 98 | pretag hook: HG_LOCAL=0 HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_TAG=a |
|
101 | 99 | precommit hook: HG_PARENT1=07f3376c1e655977439df2a814e3cc14b27abac2 |
@@ -110,7 +108,7 b' tag hooks can see env vars' | |||
|
110 | 108 | |
|
111 | 109 | pretag hook can forbid tagging |
|
112 | 110 | |
|
113 |
$ echo 'pretag.forbid = python |
|
|
111 | $ echo 'pretag.forbid = python "$TESTDIR"/printenv.py pretag.forbid 1' >> .hg/hgrc | |
|
114 | 112 | $ hg tag -d '4 0' fa |
|
115 | 113 | pretag hook: HG_LOCAL=0 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=fa |
|
116 | 114 | pretag.forbid hook: HG_LOCAL=0 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=fa |
@@ -126,7 +124,7 b' pretxncommit hook can see changeset, can' | |||
|
126 | 124 | more there after |
|
127 | 125 | |
|
128 | 126 | $ echo 'pretxncommit.forbid0 = hg tip -q' >> .hg/hgrc |
|
129 |
$ echo 'pretxncommit.forbid1 = python |
|
|
127 | $ echo 'pretxncommit.forbid1 = python "$TESTDIR"/printenv.py pretxncommit.forbid 1' >> .hg/hgrc | |
|
130 | 128 | $ echo z > z |
|
131 | 129 | $ hg add z |
|
132 | 130 | $ hg -q tip |
@@ -146,7 +144,7 b' more there after' | |||
|
146 | 144 | |
|
147 | 145 | precommit hook can prevent commit |
|
148 | 146 | |
|
149 |
$ echo 'precommit.forbid = python |
|
|
147 | $ echo 'precommit.forbid = python "$TESTDIR"/printenv.py precommit.forbid 1' >> .hg/hgrc | |
|
150 | 148 | $ hg commit -m 'fail' -d '4 0' |
|
151 | 149 | precommit hook: HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 |
|
152 | 150 | precommit.forbid hook: HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 |
@@ -157,14 +155,14 b' precommit hook can prevent commit' | |||
|
157 | 155 | |
|
158 | 156 | preupdate hook can prevent update |
|
159 | 157 | |
|
160 |
$ echo 'preupdate = python |
|
|
158 | $ echo 'preupdate = python "$TESTDIR"/printenv.py preupdate' >> .hg/hgrc | |
|
161 | 159 | $ hg update 1 |
|
162 | 160 | preupdate hook: HG_PARENT1=ab228980c14d |
|
163 | 161 | 0 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
164 | 162 | |
|
165 | 163 | update hook |
|
166 | 164 | |
|
167 |
$ echo 'update = python |
|
|
165 | $ echo 'update = python "$TESTDIR"/printenv.py update' >> .hg/hgrc | |
|
168 | 166 | $ hg update |
|
169 | 167 | preupdate hook: HG_PARENT1=539e4b31b6dc |
|
170 | 168 | update hook: HG_ERROR=0 HG_PARENT1=539e4b31b6dc |
@@ -176,7 +174,7 b' prechangegroup hook can prevent incoming' | |||
|
176 | 174 | $ hg -q tip |
|
177 | 175 | 3:07f3376c1e65 |
|
178 | 176 | $ echo '[hooks]' > .hg/hgrc |
|
179 |
$ echo 'prechangegroup.forbid = python |
|
|
177 | $ echo 'prechangegroup.forbid = python "$TESTDIR"/printenv.py prechangegroup.forbid 1' >> .hg/hgrc | |
|
180 | 178 | $ hg pull ../a |
|
181 | 179 | prechangegroup.forbid hook: HG_SOURCE=pull HG_URL=file:$TESTTMP/a |
|
182 | 180 | pulling from ../a |
@@ -189,7 +187,7 b' incoming changes no longer there after' | |||
|
189 | 187 | |
|
190 | 188 | $ echo '[hooks]' > .hg/hgrc |
|
191 | 189 | $ echo 'pretxnchangegroup.forbid0 = hg tip -q' >> .hg/hgrc |
|
192 |
$ echo 'pretxnchangegroup.forbid1 = python |
|
|
190 | $ echo 'pretxnchangegroup.forbid1 = python "$TESTDIR"/printenv.py pretxnchangegroup.forbid 1' >> .hg/hgrc | |
|
193 | 191 | $ hg pull ../a |
|
194 | 192 | 4:539e4b31b6dc |
|
195 | 193 | pretxnchangegroup.forbid hook: HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PENDING=$TESTTMP/b HG_SOURCE=pull HG_URL=file:$TESTTMP/a |
@@ -210,8 +208,8 b' outgoing hooks can see env vars' | |||
|
210 | 208 | |
|
211 | 209 | $ rm .hg/hgrc |
|
212 | 210 | $ echo '[hooks]' > ../a/.hg/hgrc |
|
213 |
$ echo 'preoutgoing = python |
|
|
214 |
$ echo 'outgoing = python |
|
|
211 | $ echo 'preoutgoing = python "$TESTDIR"/printenv.py preoutgoing' >> ../a/.hg/hgrc | |
|
212 | $ echo 'outgoing = python "$TESTDIR"/printenv.py outgoing' >> ../a/.hg/hgrc | |
|
215 | 213 | $ hg pull ../a |
|
216 | 214 | preoutgoing hook: HG_SOURCE=pull |
|
217 | 215 | outgoing hook: HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_SOURCE=pull |
@@ -227,7 +225,7 b' outgoing hooks can see env vars' | |||
|
227 | 225 | |
|
228 | 226 | preoutgoing hook can prevent outgoing changes |
|
229 | 227 | |
|
230 |
$ echo 'preoutgoing.forbid = python |
|
|
228 | $ echo 'preoutgoing.forbid = python "$TESTDIR"/printenv.py preoutgoing.forbid 1' >> ../a/.hg/hgrc | |
|
231 | 229 | $ hg pull ../a |
|
232 | 230 | preoutgoing hook: HG_SOURCE=pull |
|
233 | 231 | preoutgoing.forbid hook: HG_SOURCE=pull |
@@ -240,8 +238,8 b' outgoing hooks work for local clones' | |||
|
240 | 238 | |
|
241 | 239 | $ cd .. |
|
242 | 240 | $ echo '[hooks]' > a/.hg/hgrc |
|
243 |
$ echo 'preoutgoing = python |
|
|
244 |
$ echo 'outgoing = python |
|
|
241 | $ echo 'preoutgoing = python "$TESTDIR"/printenv.py preoutgoing' >> a/.hg/hgrc | |
|
242 | $ echo 'outgoing = python "$TESTDIR"/printenv.py outgoing' >> a/.hg/hgrc | |
|
245 | 243 | $ hg clone a c |
|
246 | 244 | preoutgoing hook: HG_SOURCE=clone |
|
247 | 245 | outgoing hook: HG_NODE=0000000000000000000000000000000000000000 HG_SOURCE=clone |
@@ -251,7 +249,7 b' outgoing hooks work for local clones' | |||
|
251 | 249 | |
|
252 | 250 | preoutgoing hook can prevent outgoing changes for local clones |
|
253 | 251 | |
|
254 |
$ echo 'preoutgoing.forbid = python |
|
|
252 | $ echo 'preoutgoing.forbid = python "$TESTDIR"/printenv.py preoutgoing.forbid 1' >> a/.hg/hgrc | |
|
255 | 253 | $ hg clone a zzz |
|
256 | 254 | preoutgoing hook: HG_SOURCE=clone |
|
257 | 255 | preoutgoing.forbid hook: HG_SOURCE=clone |
@@ -1,5 +1,4 b'' | |||
|
1 | 1 | |
|
2 | $ cp "$TESTDIR"/printenv.py . | |
|
3 | 2 | $ hg init test |
|
4 | 3 | $ cd test |
|
5 | 4 | $ echo foo>foo |
@@ -75,7 +74,7 b' pull' | |||
|
75 | 74 | |
|
76 | 75 | $ cd copy-pull |
|
77 | 76 | $ echo '[hooks]' >> .hg/hgrc |
|
78 |
$ echo 'changegroup = python |
|
|
77 | $ echo 'changegroup = python "$TESTDIR"/printenv.py changegroup' >> .hg/hgrc | |
|
79 | 78 | $ hg pull |
|
80 | 79 | changegroup hook: HG_NODE=5fed3813f7f5e1824344fdc9cf8f63bb662c292d HG_SOURCE=pull HG_URL=http://localhost:$HGPORT1/ |
|
81 | 80 | pulling from http://localhost:$HGPORT1/ |
@@ -1,5 +1,4 b'' | |||
|
1 | 1 | |
|
2 | $ cp "$TESTDIR"/printenv.py . | |
|
3 | 2 | $ hg init test |
|
4 | 3 | $ cd test |
|
5 | 4 | $ echo a > a |
@@ -1,5 +1,4 b'' | |||
|
1 | 1 | |
|
2 | $ cp "$TESTDIR"/printenv.py . | |
|
3 | 2 | $ hg init test |
|
4 | 3 | $ cd test |
|
5 | 4 | $ echo a > a |
@@ -53,7 +52,7 b' expect success' | |||
|
53 | 52 | |
|
54 | 53 | $ echo 'allow_push = *' >> .hg/hgrc |
|
55 | 54 | $ echo '[hooks]' >> .hg/hgrc |
|
56 |
$ echo 'changegroup = python |
|
|
55 | $ echo 'changegroup = python "$TESTDIR"/printenv.py changegroup 0' >> .hg/hgrc | |
|
57 | 56 | $ req |
|
58 | 57 | pushing to http://localhost:$HGPORT/ |
|
59 | 58 | searching for changes |
@@ -1,5 +1,4 b'' | |||
|
1 | 1 | |
|
2 | $ cp "$TESTDIR"/printenv.py . | |
|
3 | 2 | |
|
4 | 3 | This test tries to exercise the ssh functionality with a dummy script |
|
5 | 4 | |
@@ -45,7 +44,7 b" creating 'remote" | |||
|
45 | 44 | > bookmarks = |
|
46 | 45 | > |
|
47 | 46 | > [hooks] |
|
48 |
> changegroup = python |
|
|
47 | > changegroup = python "$TESTDIR"/printenv.py changegroup-in-remote 0 ../dummylog | |
|
49 | 48 | > EOF |
|
50 | 49 | $ cd .. |
|
51 | 50 | |
@@ -101,7 +100,7 b' verify' | |||
|
101 | 100 | checking files |
|
102 | 101 | 2 files, 1 changesets, 2 total revisions |
|
103 | 102 | $ echo '[hooks]' >> .hg/hgrc |
|
104 |
$ echo 'changegroup = python |
|
|
103 | $ echo 'changegroup = python "$TESTDIR"/printenv.py changegroup-in-local 0 ../dummylog' >> .hg/hgrc | |
|
105 | 104 | |
|
106 | 105 | empty default pull |
|
107 | 106 |
@@ -1,5 +1,4 b'' | |||
|
1 | 1 | |
|
2 | $ cp "$TESTDIR"/printenv.py . | |
|
3 | 2 | $ hg clone http://localhost:$HGPORT/ copy |
|
4 | 3 | abort: error: Connection refused |
|
5 | 4 | [255] |
@@ -67,7 +66,7 b' check for HTTP opener failures when cach' | |||
|
67 | 66 | $ rm .hg/cache/* |
|
68 | 67 | $ cd ../local |
|
69 | 68 | $ echo '[hooks]' >> .hg/hgrc |
|
70 |
$ echo 'changegroup = python |
|
|
69 | $ echo 'changegroup = python "$TESTDIR"/printenv.py changegroup' >> .hg/hgrc | |
|
71 | 70 | $ hg pull |
|
72 | 71 | changegroup hook: HG_NODE=4ac2e3648604439c580c69b09ec9d93a88d93432 HG_SOURCE=pull HG_URL=http://localhost:$HGPORT/remote |
|
73 | 72 | pulling from static-http://localhost:$HGPORT/remote |
General Comments 0
You need to be logged in to leave comments.
Login now