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