Show More
This diff has been collapsed as it changes many lines, (653 lines changed) Show them Hide them | |||||
@@ -1,943 +1,1352 b'' | |||||
1 | commit hooks can see env vars |
|
1 | commit hooks can see env vars | |
2 | (and post-transaction one are run unlocked) |
|
2 | (and post-transaction one are run unlocked) | |
3 |
|
3 | |||
4 |
|
4 | |||
5 | $ cat > $TESTTMP/txnabort.checkargs.py <<EOF |
|
5 | $ cat > $TESTTMP/txnabort.checkargs.py <<EOF | |
6 | > from mercurial import pycompat |
|
6 | > from mercurial import pycompat | |
7 | > def showargs(ui, repo, hooktype, **kwargs): |
|
7 | > def showargs(ui, repo, hooktype, **kwargs): | |
8 | > kwargs = pycompat.byteskwargs(kwargs) |
|
8 | > kwargs = pycompat.byteskwargs(kwargs) | |
9 | > ui.write(b'%s Python hook: %s\n' % (hooktype, |
|
9 | > ui.write(b'%s Python hook: %s\n' % (hooktype, | |
10 | > b','.join(sorted(kwargs)))) |
|
10 | > b','.join(sorted(kwargs)))) | |
11 | > EOF |
|
11 | > EOF | |
12 |
|
12 | |||
13 | $ hg init a |
|
13 | $ hg init a | |
14 | $ cd a |
|
14 | $ cd a | |
15 | $ cat > .hg/hgrc <<EOF |
|
15 | $ cat > .hg/hgrc <<EOF | |
16 | > [hooks] |
|
16 | > [hooks] | |
17 | > commit = sh -c "HG_LOCAL= HG_TAG= printenv.py commit" |
|
17 | > commit = sh -c "HG_LOCAL= HG_TAG= printenv.py --line commit" | |
18 | > commit.b = sh -c "HG_LOCAL= HG_TAG= printenv.py commit.b" |
|
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 precommit" |
|
19 | > precommit = sh -c "HG_LOCAL= HG_NODE= HG_TAG= printenv.py --line precommit" | |
20 | > pretxncommit = sh -c "HG_LOCAL= HG_TAG= printenv.py pretxncommit" |
|
20 | > pretxncommit = sh -c "HG_LOCAL= HG_TAG= printenv.py --line pretxncommit" | |
21 | > pretxncommit.tip = hg -q tip |
|
21 | > pretxncommit.tip = hg -q tip | |
22 | > pre-identify = sh -c "printenv.py pre-identify 1" |
|
22 | > pre-identify = sh -c "printenv.py --line pre-identify 1" | |
23 | > pre-cat = sh -c "printenv.py pre-cat" |
|
23 | > pre-cat = sh -c "printenv.py --line pre-cat" | |
24 | > post-cat = sh -c "printenv.py post-cat" |
|
24 | > post-cat = sh -c "printenv.py --line post-cat" | |
25 | > pretxnopen = sh -c "HG_LOCAL= HG_TAG= printenv.py pretxnopen" |
|
25 | > pretxnopen = sh -c "HG_LOCAL= HG_TAG= printenv.py --line pretxnopen" | |
26 | > pretxnclose = sh -c "HG_LOCAL= HG_TAG= printenv.py pretxnclose" |
|
26 | > pretxnclose = sh -c "HG_LOCAL= HG_TAG= printenv.py --line pretxnclose" | |
27 | > txnclose = sh -c "HG_LOCAL= HG_TAG= printenv.py txnclose" |
|
27 | > txnclose = sh -c "HG_LOCAL= HG_TAG= printenv.py --line txnclose" | |
28 | > txnabort.0 = python:$TESTTMP/txnabort.checkargs.py:showargs |
|
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 | > txnclose.checklock = sh -c "hg debuglock > /dev/null" |
|
30 | > txnclose.checklock = sh -c "hg debuglock > /dev/null" | |
31 | > EOF |
|
31 | > EOF | |
32 | $ echo a > a |
|
32 | $ echo a > a | |
33 | $ hg add a |
|
33 | $ hg add a | |
34 | $ hg commit -m a |
|
34 | $ hg commit -m a | |
35 | precommit hook: HG_HOOKNAME=precommit HG_HOOKTYPE=precommit HG_PARENT1=0000000000000000000000000000000000000000 |
|
35 | precommit hook: HG_HOOKNAME=precommit | |
36 | pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=commit |
|
36 | HG_HOOKTYPE=precommit | |
37 | pretxncommit hook: HG_HOOKNAME=pretxncommit HG_HOOKTYPE=pretxncommit HG_NODE=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PARENT1=0000000000000000000000000000000000000000 HG_PENDING=$TESTTMP/a |
|
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 | 0:cb9a9f314b8b |
|
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 |
|
51 | pretxnclose hook: HG_HOOKNAME=pretxnclose | |
40 | txnclose hook: HG_HOOKNAME=txnclose HG_HOOKTYPE=txnclose HG_PHASES_MOVED=1 HG_TXNID=TXN:$ID$ HG_TXNNAME=commit |
|
52 | HG_HOOKTYPE=pretxnclose | |
41 | commit hook: HG_HOOKNAME=commit HG_HOOKTYPE=commit HG_NODE=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PARENT1=0000000000000000000000000000000000000000 |
|
53 | HG_PENDING=$TESTTMP/a | |
42 | commit.b hook: HG_HOOKNAME=commit.b HG_HOOKTYPE=commit HG_NODE=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PARENT1=0000000000000000000000000000000000000000 |
|
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 | $ hg clone . ../b |
|
75 | $ hg clone . ../b | |
45 | updating to branch default |
|
76 | updating to branch default | |
46 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
77 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
47 | $ cd ../b |
|
78 | $ cd ../b | |
48 |
|
79 | |||
49 | changegroup hooks can see env vars |
|
80 | changegroup hooks can see env vars | |
50 |
|
81 | |||
51 | $ cat > .hg/hgrc <<EOF |
|
82 | $ cat > .hg/hgrc <<EOF | |
52 | > [hooks] |
|
83 | > [hooks] | |
53 | > prechangegroup = sh -c "printenv.py prechangegroup" |
|
84 | > prechangegroup = sh -c "printenv.py --line prechangegroup" | |
54 | > changegroup = sh -c "printenv.py changegroup" |
|
85 | > changegroup = sh -c "printenv.py --line changegroup" | |
55 | > incoming = sh -c "printenv.py incoming" |
|
86 | > incoming = sh -c "printenv.py --line incoming" | |
56 | > EOF |
|
87 | > EOF | |
57 |
|
88 | |||
58 | pretxncommit and commit hooks can see both parents of merge |
|
89 | pretxncommit and commit hooks can see both parents of merge | |
59 |
|
90 | |||
60 | $ cd ../a |
|
91 | $ cd ../a | |
61 | $ echo b >> a |
|
92 | $ echo b >> a | |
62 | $ hg commit -m a1 -d "1 0" |
|
93 | $ hg commit -m a1 -d "1 0" | |
63 | precommit hook: HG_HOOKNAME=precommit HG_HOOKTYPE=precommit HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b |
|
94 | precommit hook: HG_HOOKNAME=precommit | |
64 | pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=commit |
|
95 | HG_HOOKTYPE=precommit | |
65 | pretxncommit hook: HG_HOOKNAME=pretxncommit HG_HOOKTYPE=pretxncommit HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PENDING=$TESTTMP/a |
|
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 | 1:ab228980c14d |
|
109 | 1:ab228980c14d | |
67 | pretxnclose hook: HG_HOOKNAME=pretxnclose HG_HOOKTYPE=pretxnclose HG_PENDING=$TESTTMP/a HG_TXNID=TXN:$ID$ HG_TXNNAME=commit |
|
110 | pretxnclose hook: HG_HOOKNAME=pretxnclose | |
68 | txnclose hook: HG_HOOKNAME=txnclose HG_HOOKTYPE=txnclose HG_TXNID=TXN:$ID$ HG_TXNNAME=commit |
|
111 | HG_HOOKTYPE=pretxnclose | |
69 | commit hook: HG_HOOKNAME=commit HG_HOOKTYPE=commit HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b |
|
112 | HG_PENDING=$TESTTMP/a | |
70 | commit.b hook: HG_HOOKNAME=commit.b HG_HOOKTYPE=commit HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b |
|
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 | $ hg update -C 0 |
|
131 | $ hg update -C 0 | |
72 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
132 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
73 | $ echo b > b |
|
133 | $ echo b > b | |
74 | $ hg add b |
|
134 | $ hg add b | |
75 | $ hg commit -m b -d '1 0' |
|
135 | $ hg commit -m b -d '1 0' | |
76 | precommit hook: HG_HOOKNAME=precommit HG_HOOKTYPE=precommit HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b |
|
136 | precommit hook: HG_HOOKNAME=precommit | |
77 | pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=commit |
|
137 | HG_HOOKTYPE=precommit | |
78 | pretxncommit hook: HG_HOOKNAME=pretxncommit HG_HOOKTYPE=pretxncommit HG_NODE=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PENDING=$TESTTMP/a |
|
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 | 2:ee9deb46ab31 |
|
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 | created new head |
|
158 | created new head | |
82 | txnclose hook: HG_HOOKNAME=txnclose HG_HOOKTYPE=txnclose HG_TXNID=TXN:$ID$ HG_TXNNAME=commit |
|
159 | txnclose hook: HG_HOOKNAME=txnclose | |
83 | commit hook: HG_HOOKNAME=commit HG_HOOKTYPE=commit HG_NODE=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b |
|
160 | HG_HOOKTYPE=txnclose | |
84 | commit.b hook: HG_HOOKNAME=commit.b HG_HOOKTYPE=commit HG_NODE=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b |
|
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 | $ hg merge 1 |
|
174 | $ hg merge 1 | |
86 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
175 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
87 | (branch merge, don't forget to commit) |
|
176 | (branch merge, don't forget to commit) | |
88 | $ hg commit -m merge -d '2 0' |
|
177 | $ hg commit -m merge -d '2 0' | |
89 | precommit hook: HG_HOOKNAME=precommit HG_HOOKTYPE=precommit HG_PARENT1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT2=ab228980c14deea8b9555d91c9581127383e40fd |
|
178 | precommit hook: HG_HOOKNAME=precommit | |
90 | pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=commit |
|
179 | HG_HOOKTYPE=precommit | |
91 | pretxncommit hook: HG_HOOKNAME=pretxncommit HG_HOOKTYPE=pretxncommit HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_PARENT1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT2=ab228980c14deea8b9555d91c9581127383e40fd HG_PENDING=$TESTTMP/a |
|
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 | 3:07f3376c1e65 |
|
195 | 3:07f3376c1e65 | |
93 | pretxnclose hook: HG_HOOKNAME=pretxnclose HG_HOOKTYPE=pretxnclose HG_PENDING=$TESTTMP/a HG_TXNID=TXN:$ID$ HG_TXNNAME=commit |
|
196 | pretxnclose hook: HG_HOOKNAME=pretxnclose | |
94 | txnclose hook: HG_HOOKNAME=txnclose HG_HOOKTYPE=txnclose HG_TXNID=TXN:$ID$ HG_TXNNAME=commit |
|
197 | HG_HOOKTYPE=pretxnclose | |
95 | commit hook: HG_HOOKNAME=commit HG_HOOKTYPE=commit HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_PARENT1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT2=ab228980c14deea8b9555d91c9581127383e40fd |
|
198 | HG_PENDING=$TESTTMP/a | |
96 | commit.b hook: HG_HOOKNAME=commit.b HG_HOOKTYPE=commit HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_PARENT1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT2=ab228980c14deea8b9555d91c9581127383e40fd |
|
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 | test generic hooks |
|
220 | test generic hooks | |
99 |
|
221 | |||
100 | $ hg id |
|
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 | abort: pre-identify hook exited with status 1 |
|
229 | abort: pre-identify hook exited with status 1 | |
103 | [255] |
|
230 | [255] | |
104 | $ hg cat b |
|
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 | b |
|
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 | $ cd ../b |
|
247 | $ cd ../b | |
110 | $ hg pull ../a |
|
248 | $ hg pull ../a | |
111 | pulling from ../a |
|
249 | pulling from ../a | |
112 | searching for changes |
|
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 | adding changesets |
|
257 | adding changesets | |
115 | adding manifests |
|
258 | adding manifests | |
116 | adding file changes |
|
259 | adding file changes | |
117 | added 3 changesets with 2 changes to 2 files |
|
260 | added 3 changesets with 2 changes to 2 files | |
118 | new changesets ab228980c14d:07f3376c1e65 |
|
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 |
|
262 | changegroup hook: HG_HOOKNAME=changegroup | |
120 | incoming hook: HG_HOOKNAME=incoming HG_HOOKTYPE=incoming HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_SOURCE=pull HG_TXNID=TXN:$ID$ HG_URL=file:$TESTTMP/a |
|
263 | HG_HOOKTYPE=changegroup | |
121 | incoming hook: HG_HOOKNAME=incoming HG_HOOKTYPE=incoming HG_NODE=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_SOURCE=pull HG_TXNID=TXN:$ID$ HG_URL=file:$TESTTMP/a |
|
264 | HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd | |
122 | incoming hook: HG_HOOKNAME=incoming HG_HOOKTYPE=incoming HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_SOURCE=pull HG_TXNID=TXN:$ID$ HG_URL=file:$TESTTMP/a |
|
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 | (run 'hg update' to get a working copy) |
|
291 | (run 'hg update' to get a working copy) | |
124 |
|
292 | |||
125 | tag hooks can see env vars |
|
293 | tag hooks can see env vars | |
126 |
|
294 | |||
127 | $ cd ../a |
|
295 | $ cd ../a | |
128 | $ cat >> .hg/hgrc <<EOF |
|
296 | $ cat >> .hg/hgrc <<EOF | |
129 | > pretag = sh -c "printenv.py pretag" |
|
297 | > pretag = sh -c "printenv.py --line pretag" | |
130 | > tag = sh -c "HG_PARENT1= HG_PARENT2= printenv.py tag" |
|
298 | > tag = sh -c "HG_PARENT1= HG_PARENT2= printenv.py --line tag" | |
131 | > EOF |
|
299 | > EOF | |
132 | $ hg tag -d '3 0' a |
|
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 |
|
301 | pretag hook: HG_HOOKNAME=pretag | |
134 | precommit hook: HG_HOOKNAME=precommit HG_HOOKTYPE=precommit HG_PARENT1=07f3376c1e655977439df2a814e3cc14b27abac2 |
|
302 | HG_HOOKTYPE=pretag | |
135 | pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=commit |
|
303 | HG_LOCAL=0 | |
136 | pretxncommit hook: HG_HOOKNAME=pretxncommit HG_HOOKTYPE=pretxncommit HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PARENT1=07f3376c1e655977439df2a814e3cc14b27abac2 HG_PENDING=$TESTTMP/a |
|
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 | 4:539e4b31b6dc |
|
322 | 4:539e4b31b6dc | |
138 | pretxnclose hook: HG_HOOKNAME=pretxnclose HG_HOOKTYPE=pretxnclose HG_PENDING=$TESTTMP/a HG_TXNID=TXN:$ID$ HG_TXNNAME=commit |
|
323 | pretxnclose hook: HG_HOOKNAME=pretxnclose | |
139 | tag hook: HG_HOOKNAME=tag HG_HOOKTYPE=tag HG_LOCAL=0 HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_TAG=a |
|
324 | HG_HOOKTYPE=pretxnclose | |
140 | txnclose hook: HG_HOOKNAME=txnclose HG_HOOKTYPE=txnclose HG_TXNID=TXN:$ID$ HG_TXNNAME=commit |
|
325 | HG_PENDING=$TESTTMP/a | |
141 | commit hook: HG_HOOKNAME=commit HG_HOOKTYPE=commit HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PARENT1=07f3376c1e655977439df2a814e3cc14b27abac2 |
|
326 | HG_TXNID=TXN:$ID$ | |
142 | commit.b hook: HG_HOOKNAME=commit.b HG_HOOKTYPE=commit HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PARENT1=07f3376c1e655977439df2a814e3cc14b27abac2 |
|
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 | $ hg tag -l la |
|
350 | $ hg tag -l la | |
144 | pretag hook: HG_HOOKNAME=pretag HG_HOOKTYPE=pretag HG_LOCAL=1 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=la |
|
351 | pretag hook: HG_HOOKNAME=pretag | |
145 | tag hook: HG_HOOKNAME=tag HG_HOOKTYPE=tag HG_LOCAL=1 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=la |
|
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 | pretag hook can forbid tagging |
|
364 | pretag hook can forbid tagging | |
148 |
|
365 | |||
149 | $ cat >> .hg/hgrc <<EOF |
|
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 | > EOF |
|
368 | > EOF | |
152 | $ hg tag -d '4 0' fa |
|
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 |
|
370 | pretag hook: HG_HOOKNAME=pretag | |
154 | pretag.forbid hook: HG_HOOKNAME=pretag.forbid HG_HOOKTYPE=pretag HG_LOCAL=0 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=fa |
|
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 | abort: pretag.forbid hook exited with status 1 |
|
382 | abort: pretag.forbid hook exited with status 1 | |
156 | [255] |
|
383 | [255] | |
157 | $ hg tag -l fla |
|
384 | $ hg tag -l fla | |
158 | pretag hook: HG_HOOKNAME=pretag HG_HOOKTYPE=pretag HG_LOCAL=1 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=fla |
|
385 | pretag hook: HG_HOOKNAME=pretag | |
159 | pretag.forbid hook: HG_HOOKNAME=pretag.forbid HG_HOOKTYPE=pretag HG_LOCAL=1 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=fla |
|
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 | abort: pretag.forbid hook exited with status 1 |
|
397 | abort: pretag.forbid hook exited with status 1 | |
161 | [255] |
|
398 | [255] | |
162 |
|
399 | |||
163 | pretxncommit hook can see changeset, can roll back txn, changeset no |
|
400 | pretxncommit hook can see changeset, can roll back txn, changeset no | |
164 | more there after |
|
401 | more there after | |
165 |
|
402 | |||
166 | $ cat >> .hg/hgrc <<EOF |
|
403 | $ cat >> .hg/hgrc <<EOF | |
167 | > pretxncommit.forbid0 = sh -c "hg tip -q" |
|
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 | > EOF |
|
406 | > EOF | |
170 | $ echo z > z |
|
407 | $ echo z > z | |
171 | $ hg add z |
|
408 | $ hg add z | |
172 | $ hg -q tip |
|
409 | $ hg -q tip | |
173 | 4:539e4b31b6dc |
|
410 | 4:539e4b31b6dc | |
174 | $ hg commit -m 'fail' -d '4 0' |
|
411 | $ hg commit -m 'fail' -d '4 0' | |
175 | precommit hook: HG_HOOKNAME=precommit HG_HOOKTYPE=precommit HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 |
|
412 | precommit hook: HG_HOOKNAME=precommit | |
176 | pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=commit |
|
413 | HG_HOOKTYPE=precommit | |
177 | pretxncommit hook: HG_HOOKNAME=pretxncommit HG_HOOKTYPE=pretxncommit HG_NODE=6f611f8018c10e827fee6bd2bc807f937e761567 HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PENDING=$TESTTMP/a |
|
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 | 5:6f611f8018c1 |
|
427 | 5:6f611f8018c1 | |
179 | 5:6f611f8018c1 |
|
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 | transaction abort! |
|
435 | transaction abort! | |
182 | txnabort Python hook: txnid,txnname |
|
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 | rollback completed |
|
442 | rollback completed | |
185 | abort: pretxncommit.forbid1 hook exited with status 1 |
|
443 | abort: pretxncommit.forbid1 hook exited with status 1 | |
186 | [255] |
|
444 | [255] | |
187 | $ hg -q tip |
|
445 | $ hg -q tip | |
188 | 4:539e4b31b6dc |
|
446 | 4:539e4b31b6dc | |
189 |
|
447 | |||
190 | (Check that no 'changelog.i.a' file were left behind) |
|
448 | (Check that no 'changelog.i.a' file were left behind) | |
191 |
|
449 | |||
192 | $ ls -1 .hg/store/ |
|
450 | $ ls -1 .hg/store/ | |
193 | 00changelog.i |
|
451 | 00changelog.i | |
194 | 00manifest.i |
|
452 | 00manifest.i | |
195 | data |
|
453 | data | |
196 | fncache (repofncache !) |
|
454 | fncache (repofncache !) | |
197 | journal.phaseroots |
|
455 | journal.phaseroots | |
198 | phaseroots |
|
456 | phaseroots | |
199 | undo |
|
457 | undo | |
200 | undo.backup.fncache (repofncache !) |
|
458 | undo.backup.fncache (repofncache !) | |
201 | undo.backupfiles |
|
459 | undo.backupfiles | |
202 | undo.phaseroots |
|
460 | undo.phaseroots | |
203 |
|
461 | |||
204 |
|
462 | |||
205 | precommit hook can prevent commit |
|
463 | precommit hook can prevent commit | |
206 |
|
464 | |||
207 | $ cat >> .hg/hgrc <<EOF |
|
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 | > EOF |
|
467 | > EOF | |
210 | $ hg commit -m 'fail' -d '4 0' |
|
468 | $ hg commit -m 'fail' -d '4 0' | |
211 | precommit hook: HG_HOOKNAME=precommit HG_HOOKTYPE=precommit HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 |
|
469 | precommit hook: HG_HOOKNAME=precommit | |
212 | precommit.forbid hook: HG_HOOKNAME=precommit.forbid HG_HOOKTYPE=precommit HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 |
|
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 | abort: precommit.forbid hook exited with status 1 |
|
477 | abort: precommit.forbid hook exited with status 1 | |
214 | [255] |
|
478 | [255] | |
215 | $ hg -q tip |
|
479 | $ hg -q tip | |
216 | 4:539e4b31b6dc |
|
480 | 4:539e4b31b6dc | |
217 |
|
481 | |||
218 | preupdate hook can prevent update |
|
482 | preupdate hook can prevent update | |
219 |
|
483 | |||
220 | $ cat >> .hg/hgrc <<EOF |
|
484 | $ cat >> .hg/hgrc <<EOF | |
221 | > preupdate = sh -c "printenv.py preupdate" |
|
485 | > preupdate = sh -c "printenv.py --line preupdate" | |
222 | > EOF |
|
486 | > EOF | |
223 | $ hg update 1 |
|
487 | $ hg update 1 | |
224 |
preupdate hook: HG_HOOKNAME=preupdate |
|
488 | preupdate hook: HG_HOOKNAME=preupdate | |
|
489 | HG_HOOKTYPE=preupdate | |||
|
490 | HG_PARENT1=ab228980c14d | |||
|
491 | ||||
225 | 0 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
492 | 0 files updated, 0 files merged, 2 files removed, 0 files unresolved | |
226 |
|
493 | |||
227 | update hook |
|
494 | update hook | |
228 |
|
495 | |||
229 | $ cat >> .hg/hgrc <<EOF |
|
496 | $ cat >> .hg/hgrc <<EOF | |
230 | > update = sh -c "printenv.py update" |
|
497 | > update = sh -c "printenv.py --line update" | |
231 | > EOF |
|
498 | > EOF | |
232 | $ hg update |
|
499 | $ hg update | |
233 |
preupdate hook: HG_HOOKNAME=preupdate |
|
500 | preupdate hook: HG_HOOKNAME=preupdate | |
234 | update hook: HG_ERROR=0 HG_HOOKNAME=update HG_HOOKTYPE=update HG_PARENT1=539e4b31b6dc |
|
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 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
509 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
236 |
|
510 | |||
237 | pushkey hook |
|
511 | pushkey hook | |
238 |
|
512 | |||
239 | $ cat >> .hg/hgrc <<EOF |
|
513 | $ cat >> .hg/hgrc <<EOF | |
240 | > pushkey = sh -c "printenv.py pushkey" |
|
514 | > pushkey = sh -c "printenv.py --line pushkey" | |
241 | > EOF |
|
515 | > EOF | |
242 | $ cd ../b |
|
516 | $ cd ../b | |
243 | $ hg bookmark -r null foo |
|
517 | $ hg bookmark -r null foo | |
244 | $ hg push -B foo ../a |
|
518 | $ hg push -B foo ../a | |
245 | pushing to ../a |
|
519 | pushing to ../a | |
246 | searching for changes |
|
520 | searching for changes | |
247 | no changes found |
|
521 | no changes found | |
248 | pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=push |
|
522 | pretxnopen hook: HG_HOOKNAME=pretxnopen | |
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 |
|
523 | HG_HOOKTYPE=pretxnopen | |
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 |
|
524 | HG_TXNID=TXN:$ID$ | |
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 |
|
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 | exporting bookmark foo |
|
557 | exporting bookmark foo | |
253 | [1] |
|
558 | [1] | |
254 | $ cd ../a |
|
559 | $ cd ../a | |
255 |
|
560 | |||
256 | listkeys hook |
|
561 | listkeys hook | |
257 |
|
562 | |||
258 | $ cat >> .hg/hgrc <<EOF |
|
563 | $ cat >> .hg/hgrc <<EOF | |
259 | > listkeys = sh -c "printenv.py listkeys" |
|
564 | > listkeys = sh -c "printenv.py --line listkeys" | |
260 | > EOF |
|
565 | > EOF | |
261 | $ hg bookmark -r null bar |
|
566 | $ hg bookmark -r null bar | |
262 | pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=bookmark |
|
567 | pretxnopen hook: HG_HOOKNAME=pretxnopen | |
263 | pretxnclose hook: HG_BOOKMARK_MOVED=1 HG_HOOKNAME=pretxnclose HG_HOOKTYPE=pretxnclose HG_PENDING=$TESTTMP/a HG_TXNID=TXN:$ID$ HG_TXNNAME=bookmark |
|
568 | HG_HOOKTYPE=pretxnopen | |
264 | txnclose hook: HG_BOOKMARK_MOVED=1 HG_HOOKNAME=txnclose HG_HOOKTYPE=txnclose HG_TXNID=TXN:$ID$ HG_TXNNAME=bookmark |
|
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 | $ cd ../b |
|
585 | $ cd ../b | |
266 | $ hg pull -B bar ../a |
|
586 | $ hg pull -B bar ../a | |
267 | pulling from ../a |
|
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 | no changes found |
|
593 | no changes found | |
270 | adding remote bookmark bar |
|
594 | adding remote bookmark bar | |
271 | $ cd ../a |
|
595 | $ cd ../a | |
272 |
|
596 | |||
273 | test that prepushkey can prevent incoming keys |
|
597 | test that prepushkey can prevent incoming keys | |
274 |
|
598 | |||
275 | $ cat >> .hg/hgrc <<EOF |
|
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 | > EOF |
|
601 | > EOF | |
278 | $ cd ../b |
|
602 | $ cd ../b | |
279 | $ hg bookmark -r null baz |
|
603 | $ hg bookmark -r null baz | |
280 | $ hg push -B baz ../a |
|
604 | $ hg push -B baz ../a | |
281 | pushing to ../a |
|
605 | pushing to ../a | |
282 | searching for changes |
|
606 | searching for changes | |
283 | listkeys hook: HG_HOOKNAME=listkeys HG_HOOKTYPE=listkeys HG_NAMESPACE=phases HG_VALUES={'cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b': '1', 'publishing': 'True'} |
|
607 | listkeys hook: HG_HOOKNAME=listkeys | |
284 | listkeys hook: HG_HOOKNAME=listkeys HG_HOOKTYPE=listkeys HG_NAMESPACE=bookmarks HG_VALUES={'bar': '0000000000000000000000000000000000000000', 'foo': '0000000000000000000000000000000000000000'} |
|
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 | no changes found |
|
617 | no changes found | |
286 | pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=push |
|
618 | pretxnopen hook: HG_HOOKNAME=pretxnopen | |
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 |
|
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 | abort: prepushkey hook exited with status 1 |
|
634 | abort: prepushkey hook exited with status 1 | |
289 | [255] |
|
635 | [255] | |
290 | $ cd ../a |
|
636 | $ cd ../a | |
291 |
|
637 | |||
292 | test that prelistkeys can prevent listing keys |
|
638 | test that prelistkeys can prevent listing keys | |
293 |
|
639 | |||
294 | $ cat >> .hg/hgrc <<EOF |
|
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 | > EOF |
|
642 | > EOF | |
297 | $ hg bookmark -r null quux |
|
643 | $ hg bookmark -r null quux | |
298 | pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=bookmark |
|
644 | pretxnopen hook: HG_HOOKNAME=pretxnopen | |
299 | pretxnclose hook: HG_BOOKMARK_MOVED=1 HG_HOOKNAME=pretxnclose HG_HOOKTYPE=pretxnclose HG_PENDING=$TESTTMP/a HG_TXNID=TXN:$ID$ HG_TXNNAME=bookmark |
|
645 | HG_HOOKTYPE=pretxnopen | |
300 | txnclose hook: HG_BOOKMARK_MOVED=1 HG_HOOKNAME=txnclose HG_HOOKTYPE=txnclose HG_TXNID=TXN:$ID$ HG_TXNNAME=bookmark |
|
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 | $ cd ../b |
|
662 | $ cd ../b | |
302 | $ hg pull -B quux ../a |
|
663 | $ hg pull -B quux ../a | |
303 | pulling from ../a |
|
664 | pulling from ../a | |
304 |
prelistkeys.forbid hook: HG_HOOKNAME=prelistkeys |
|
665 | prelistkeys.forbid hook: HG_HOOKNAME=prelistkeys | |
|
666 | HG_HOOKTYPE=prelistkeys | |||
|
667 | HG_NAMESPACE=bookmarks | |||
|
668 | ||||
305 | abort: prelistkeys hook exited with status 1 |
|
669 | abort: prelistkeys hook exited with status 1 | |
306 | [255] |
|
670 | [255] | |
307 | $ cd ../a |
|
671 | $ cd ../a | |
308 | $ rm .hg/hgrc |
|
672 | $ rm .hg/hgrc | |
309 |
|
673 | |||
310 | prechangegroup hook can prevent incoming changes |
|
674 | prechangegroup hook can prevent incoming changes | |
311 |
|
675 | |||
312 | $ cd ../b |
|
676 | $ cd ../b | |
313 | $ hg -q tip |
|
677 | $ hg -q tip | |
314 | 3:07f3376c1e65 |
|
678 | 3:07f3376c1e65 | |
315 | $ cat > .hg/hgrc <<EOF |
|
679 | $ cat > .hg/hgrc <<EOF | |
316 | > [hooks] |
|
680 | > [hooks] | |
317 | > prechangegroup.forbid = sh -c "printenv.py prechangegroup.forbid 1" |
|
681 | > prechangegroup.forbid = sh -c "printenv.py --line prechangegroup.forbid 1" | |
318 | > EOF |
|
682 | > EOF | |
319 | $ hg pull ../a |
|
683 | $ hg pull ../a | |
320 | pulling from ../a |
|
684 | pulling from ../a | |
321 | searching for changes |
|
685 | searching for changes | |
322 |
prechangegroup.forbid hook: HG_HOOKNAME=prechangegroup.forbid |
|
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 | abort: prechangegroup.forbid hook exited with status 1 |
|
692 | abort: prechangegroup.forbid hook exited with status 1 | |
324 | [255] |
|
693 | [255] | |
325 |
|
694 | |||
326 | pretxnchangegroup hook can see incoming changes, can roll back txn, |
|
695 | pretxnchangegroup hook can see incoming changes, can roll back txn, | |
327 | incoming changes no longer there after |
|
696 | incoming changes no longer there after | |
328 |
|
697 | |||
329 | $ cat > .hg/hgrc <<EOF |
|
698 | $ cat > .hg/hgrc <<EOF | |
330 | > [hooks] |
|
699 | > [hooks] | |
331 | > pretxnchangegroup.forbid0 = hg tip -q |
|
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 | > EOF |
|
702 | > EOF | |
334 | $ hg pull ../a |
|
703 | $ hg pull ../a | |
335 | pulling from ../a |
|
704 | pulling from ../a | |
336 | searching for changes |
|
705 | searching for changes | |
337 | adding changesets |
|
706 | adding changesets | |
338 | adding manifests |
|
707 | adding manifests | |
339 | adding file changes |
|
708 | adding file changes | |
340 | added 1 changesets with 1 changes to 1 files |
|
709 | added 1 changesets with 1 changes to 1 files | |
341 | 4:539e4b31b6dc |
|
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 | transaction abort! |
|
720 | transaction abort! | |
344 | rollback completed |
|
721 | rollback completed | |
345 | abort: pretxnchangegroup.forbid1 hook exited with status 1 |
|
722 | abort: pretxnchangegroup.forbid1 hook exited with status 1 | |
346 | [255] |
|
723 | [255] | |
347 | $ hg -q tip |
|
724 | $ hg -q tip | |
348 | 3:07f3376c1e65 |
|
725 | 3:07f3376c1e65 | |
349 |
|
726 | |||
350 | outgoing hooks can see env vars |
|
727 | outgoing hooks can see env vars | |
351 |
|
728 | |||
352 | $ rm .hg/hgrc |
|
729 | $ rm .hg/hgrc | |
353 | $ cat > ../a/.hg/hgrc <<EOF |
|
730 | $ cat > ../a/.hg/hgrc <<EOF | |
354 | > [hooks] |
|
731 | > [hooks] | |
355 | > preoutgoing = sh -c "printenv.py preoutgoing" |
|
732 | > preoutgoing = sh -c "printenv.py --line preoutgoing" | |
356 | > outgoing = sh -c "printenv.py outgoing" |
|
733 | > outgoing = sh -c "printenv.py --line outgoing" | |
357 | > EOF |
|
734 | > EOF | |
358 | $ hg pull ../a |
|
735 | $ hg pull ../a | |
359 | pulling from ../a |
|
736 | pulling from ../a | |
360 | searching for changes |
|
737 | searching for changes | |
361 |
preoutgoing hook: HG_HOOKNAME=preoutgoing |
|
738 | preoutgoing hook: HG_HOOKNAME=preoutgoing | |
362 | outgoing hook: HG_HOOKNAME=outgoing HG_HOOKTYPE=outgoing HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_SOURCE=pull |
|
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 | adding changesets |
|
747 | adding changesets | |
364 | adding manifests |
|
748 | adding manifests | |
365 | adding file changes |
|
749 | adding file changes | |
366 | added 1 changesets with 1 changes to 1 files |
|
750 | added 1 changesets with 1 changes to 1 files | |
367 | adding remote bookmark quux |
|
751 | adding remote bookmark quux | |
368 | new changesets 539e4b31b6dc |
|
752 | new changesets 539e4b31b6dc | |
369 | (run 'hg update' to get a working copy) |
|
753 | (run 'hg update' to get a working copy) | |
370 | $ hg rollback |
|
754 | $ hg rollback | |
371 | repository tip rolled back to revision 3 (undo pull) |
|
755 | repository tip rolled back to revision 3 (undo pull) | |
372 |
|
756 | |||
373 | preoutgoing hook can prevent outgoing changes |
|
757 | preoutgoing hook can prevent outgoing changes | |
374 |
|
758 | |||
375 | $ cat >> ../a/.hg/hgrc <<EOF |
|
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 | > EOF |
|
761 | > EOF | |
378 | $ hg pull ../a |
|
762 | $ hg pull ../a | |
379 | pulling from ../a |
|
763 | pulling from ../a | |
380 | searching for changes |
|
764 | searching for changes | |
381 |
preoutgoing hook: HG_HOOKNAME=preoutgoing |
|
765 | preoutgoing hook: HG_HOOKNAME=preoutgoing | |
382 | preoutgoing.forbid hook: HG_HOOKNAME=preoutgoing.forbid HG_HOOKTYPE=preoutgoing HG_SOURCE=pull |
|
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 | abort: preoutgoing.forbid hook exited with status 1 |
|
773 | abort: preoutgoing.forbid hook exited with status 1 | |
384 | [255] |
|
774 | [255] | |
385 |
|
775 | |||
386 | outgoing hooks work for local clones |
|
776 | outgoing hooks work for local clones | |
387 |
|
777 | |||
388 | $ cd .. |
|
778 | $ cd .. | |
389 | $ cat > a/.hg/hgrc <<EOF |
|
779 | $ cat > a/.hg/hgrc <<EOF | |
390 | > [hooks] |
|
780 | > [hooks] | |
391 | > preoutgoing = sh -c "printenv.py preoutgoing" |
|
781 | > preoutgoing = sh -c "printenv.py --line preoutgoing" | |
392 | > outgoing = sh -c "printenv.py outgoing" |
|
782 | > outgoing = sh -c "printenv.py --line outgoing" | |
393 | > EOF |
|
783 | > EOF | |
394 | $ hg clone a c |
|
784 | $ hg clone a c | |
395 |
preoutgoing hook: HG_HOOKNAME=preoutgoing |
|
785 | preoutgoing hook: HG_HOOKNAME=preoutgoing | |
396 | outgoing hook: HG_HOOKNAME=outgoing HG_HOOKTYPE=outgoing HG_NODE=0000000000000000000000000000000000000000 HG_SOURCE=clone |
|
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 | updating to branch default |
|
794 | updating to branch default | |
398 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
795 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
399 | $ rm -rf c |
|
796 | $ rm -rf c | |
400 |
|
797 | |||
401 | preoutgoing hook can prevent outgoing changes for local clones |
|
798 | preoutgoing hook can prevent outgoing changes for local clones | |
402 |
|
799 | |||
403 | $ cat >> a/.hg/hgrc <<EOF |
|
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 | > EOF |
|
802 | > EOF | |
406 | $ hg clone a zzz |
|
803 | $ hg clone a zzz | |
407 |
preoutgoing hook: HG_HOOKNAME=preoutgoing |
|
804 | preoutgoing hook: HG_HOOKNAME=preoutgoing | |
408 | preoutgoing.forbid hook: HG_HOOKNAME=preoutgoing.forbid HG_HOOKTYPE=preoutgoing HG_SOURCE=clone |
|
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 | abort: preoutgoing.forbid hook exited with status 1 |
|
812 | abort: preoutgoing.forbid hook exited with status 1 | |
410 | [255] |
|
813 | [255] | |
411 |
|
814 | |||
412 | $ cd "$TESTTMP/b" |
|
815 | $ cd "$TESTTMP/b" | |
413 |
|
816 | |||
414 | $ cat > hooktests.py <<EOF |
|
817 | $ cat > hooktests.py <<EOF | |
415 | > from __future__ import print_function |
|
818 | > from __future__ import print_function | |
416 | > from mercurial import ( |
|
819 | > from mercurial import ( | |
417 | > error, |
|
820 | > error, | |
418 | > pycompat, |
|
821 | > pycompat, | |
419 | > ) |
|
822 | > ) | |
420 | > |
|
823 | > | |
421 | > uncallable = 0 |
|
824 | > uncallable = 0 | |
422 | > |
|
825 | > | |
423 | > def printargs(ui, args): |
|
826 | > def printargs(ui, args): | |
424 | > a = list(pycompat.byteskwargs(args).items()) |
|
827 | > a = list(pycompat.byteskwargs(args).items()) | |
425 | > a.sort() |
|
828 | > a.sort() | |
426 | > ui.write(b'hook args:\n') |
|
829 | > ui.write(b'hook args:\n') | |
427 | > for k, v in a: |
|
830 | > for k, v in a: | |
428 | > ui.write(b' %s %s\n' % (k, v)) |
|
831 | > ui.write(b' %s %s\n' % (k, v)) | |
429 | > |
|
832 | > | |
430 | > def passhook(ui, repo, **args): |
|
833 | > def passhook(ui, repo, **args): | |
431 | > printargs(ui, args) |
|
834 | > printargs(ui, args) | |
432 | > |
|
835 | > | |
433 | > def failhook(ui, repo, **args): |
|
836 | > def failhook(ui, repo, **args): | |
434 | > printargs(ui, args) |
|
837 | > printargs(ui, args) | |
435 | > return True |
|
838 | > return True | |
436 | > |
|
839 | > | |
437 | > class LocalException(Exception): |
|
840 | > class LocalException(Exception): | |
438 | > pass |
|
841 | > pass | |
439 | > |
|
842 | > | |
440 | > def raisehook(**args): |
|
843 | > def raisehook(**args): | |
441 | > raise LocalException('exception from hook') |
|
844 | > raise LocalException('exception from hook') | |
442 | > |
|
845 | > | |
443 | > def aborthook(**args): |
|
846 | > def aborthook(**args): | |
444 | > raise error.Abort(b'raise abort from hook') |
|
847 | > raise error.Abort(b'raise abort from hook') | |
445 | > |
|
848 | > | |
446 | > def brokenhook(**args): |
|
849 | > def brokenhook(**args): | |
447 | > return 1 + {} |
|
850 | > return 1 + {} | |
448 | > |
|
851 | > | |
449 | > def verbosehook(ui, **args): |
|
852 | > def verbosehook(ui, **args): | |
450 | > ui.note(b'verbose output from hook\n') |
|
853 | > ui.note(b'verbose output from hook\n') | |
451 | > |
|
854 | > | |
452 | > def printtags(ui, repo, **args): |
|
855 | > def printtags(ui, repo, **args): | |
453 | > ui.write(b'[%s]\n' % b', '.join(sorted(repo.tags()))) |
|
856 | > ui.write(b'[%s]\n' % b', '.join(sorted(repo.tags()))) | |
454 | > |
|
857 | > | |
455 | > class container: |
|
858 | > class container: | |
456 | > unreachable = 1 |
|
859 | > unreachable = 1 | |
457 | > EOF |
|
860 | > EOF | |
458 |
|
861 | |||
459 | $ cat > syntaxerror.py << NO_CHECK_EOF |
|
862 | $ cat > syntaxerror.py << NO_CHECK_EOF | |
460 | > (foo |
|
863 | > (foo | |
461 | > NO_CHECK_EOF |
|
864 | > NO_CHECK_EOF | |
462 |
|
865 | |||
463 | test python hooks |
|
866 | test python hooks | |
464 |
|
867 | |||
465 | #if windows |
|
868 | #if windows | |
466 | $ PYTHONPATH="$TESTTMP/b;$PYTHONPATH" |
|
869 | $ PYTHONPATH="$TESTTMP/b;$PYTHONPATH" | |
467 | #else |
|
870 | #else | |
468 | $ PYTHONPATH="$TESTTMP/b:$PYTHONPATH" |
|
871 | $ PYTHONPATH="$TESTTMP/b:$PYTHONPATH" | |
469 | #endif |
|
872 | #endif | |
470 | $ export PYTHONPATH |
|
873 | $ export PYTHONPATH | |
471 |
|
874 | |||
472 | $ echo '[hooks]' > ../a/.hg/hgrc |
|
875 | $ echo '[hooks]' > ../a/.hg/hgrc | |
473 | $ echo 'preoutgoing.broken = python:hooktests.brokenhook' >> ../a/.hg/hgrc |
|
876 | $ echo 'preoutgoing.broken = python:hooktests.brokenhook' >> ../a/.hg/hgrc | |
474 | $ hg pull ../a 2>&1 | grep 'raised an exception' |
|
877 | $ hg pull ../a 2>&1 | grep 'raised an exception' | |
475 | error: preoutgoing.broken hook raised an exception: unsupported operand type(s) for +: 'int' and 'dict' |
|
878 | error: preoutgoing.broken hook raised an exception: unsupported operand type(s) for +: 'int' and 'dict' | |
476 |
|
879 | |||
477 | $ echo '[hooks]' > ../a/.hg/hgrc |
|
880 | $ echo '[hooks]' > ../a/.hg/hgrc | |
478 | $ echo 'preoutgoing.raise = python:hooktests.raisehook' >> ../a/.hg/hgrc |
|
881 | $ echo 'preoutgoing.raise = python:hooktests.raisehook' >> ../a/.hg/hgrc | |
479 | $ hg pull ../a 2>&1 | grep 'raised an exception' |
|
882 | $ hg pull ../a 2>&1 | grep 'raised an exception' | |
480 | error: preoutgoing.raise hook raised an exception: exception from hook |
|
883 | error: preoutgoing.raise hook raised an exception: exception from hook | |
481 |
|
884 | |||
482 | $ echo '[hooks]' > ../a/.hg/hgrc |
|
885 | $ echo '[hooks]' > ../a/.hg/hgrc | |
483 | $ echo 'preoutgoing.abort = python:hooktests.aborthook' >> ../a/.hg/hgrc |
|
886 | $ echo 'preoutgoing.abort = python:hooktests.aborthook' >> ../a/.hg/hgrc | |
484 | $ hg pull ../a |
|
887 | $ hg pull ../a | |
485 | pulling from ../a |
|
888 | pulling from ../a | |
486 | searching for changes |
|
889 | searching for changes | |
487 | error: preoutgoing.abort hook failed: raise abort from hook |
|
890 | error: preoutgoing.abort hook failed: raise abort from hook | |
488 | abort: raise abort from hook |
|
891 | abort: raise abort from hook | |
489 | [255] |
|
892 | [255] | |
490 |
|
893 | |||
491 | $ echo '[hooks]' > ../a/.hg/hgrc |
|
894 | $ echo '[hooks]' > ../a/.hg/hgrc | |
492 | $ echo 'preoutgoing.fail = python:hooktests.failhook' >> ../a/.hg/hgrc |
|
895 | $ echo 'preoutgoing.fail = python:hooktests.failhook' >> ../a/.hg/hgrc | |
493 | $ hg pull ../a |
|
896 | $ hg pull ../a | |
494 | pulling from ../a |
|
897 | pulling from ../a | |
495 | searching for changes |
|
898 | searching for changes | |
496 | hook args: |
|
899 | hook args: | |
497 | hooktype preoutgoing |
|
900 | hooktype preoutgoing | |
498 | source pull |
|
901 | source pull | |
499 | abort: preoutgoing.fail hook failed |
|
902 | abort: preoutgoing.fail hook failed | |
500 | [255] |
|
903 | [255] | |
501 |
|
904 | |||
502 | $ echo '[hooks]' > ../a/.hg/hgrc |
|
905 | $ echo '[hooks]' > ../a/.hg/hgrc | |
503 | $ echo 'preoutgoing.uncallable = python:hooktests.uncallable' >> ../a/.hg/hgrc |
|
906 | $ echo 'preoutgoing.uncallable = python:hooktests.uncallable' >> ../a/.hg/hgrc | |
504 | $ hg pull ../a |
|
907 | $ hg pull ../a | |
505 | pulling from ../a |
|
908 | pulling from ../a | |
506 | searching for changes |
|
909 | searching for changes | |
507 | abort: preoutgoing.uncallable hook is invalid: "hooktests.uncallable" is not callable |
|
910 | abort: preoutgoing.uncallable hook is invalid: "hooktests.uncallable" is not callable | |
508 | [255] |
|
911 | [255] | |
509 |
|
912 | |||
510 | $ echo '[hooks]' > ../a/.hg/hgrc |
|
913 | $ echo '[hooks]' > ../a/.hg/hgrc | |
511 | $ echo 'preoutgoing.nohook = python:hooktests.nohook' >> ../a/.hg/hgrc |
|
914 | $ echo 'preoutgoing.nohook = python:hooktests.nohook' >> ../a/.hg/hgrc | |
512 | $ hg pull ../a |
|
915 | $ hg pull ../a | |
513 | pulling from ../a |
|
916 | pulling from ../a | |
514 | searching for changes |
|
917 | searching for changes | |
515 | abort: preoutgoing.nohook hook is invalid: "hooktests.nohook" is not defined |
|
918 | abort: preoutgoing.nohook hook is invalid: "hooktests.nohook" is not defined | |
516 | [255] |
|
919 | [255] | |
517 |
|
920 | |||
518 | $ echo '[hooks]' > ../a/.hg/hgrc |
|
921 | $ echo '[hooks]' > ../a/.hg/hgrc | |
519 | $ echo 'preoutgoing.nomodule = python:nomodule' >> ../a/.hg/hgrc |
|
922 | $ echo 'preoutgoing.nomodule = python:nomodule' >> ../a/.hg/hgrc | |
520 | $ hg pull ../a |
|
923 | $ hg pull ../a | |
521 | pulling from ../a |
|
924 | pulling from ../a | |
522 | searching for changes |
|
925 | searching for changes | |
523 | abort: preoutgoing.nomodule hook is invalid: "nomodule" not in a module |
|
926 | abort: preoutgoing.nomodule hook is invalid: "nomodule" not in a module | |
524 | [255] |
|
927 | [255] | |
525 |
|
928 | |||
526 | $ echo '[hooks]' > ../a/.hg/hgrc |
|
929 | $ echo '[hooks]' > ../a/.hg/hgrc | |
527 | $ echo 'preoutgoing.badmodule = python:nomodule.nowhere' >> ../a/.hg/hgrc |
|
930 | $ echo 'preoutgoing.badmodule = python:nomodule.nowhere' >> ../a/.hg/hgrc | |
528 | $ hg pull ../a |
|
931 | $ hg pull ../a | |
529 | pulling from ../a |
|
932 | pulling from ../a | |
530 | searching for changes |
|
933 | searching for changes | |
531 | abort: preoutgoing.badmodule hook is invalid: import of "nomodule" failed |
|
934 | abort: preoutgoing.badmodule hook is invalid: import of "nomodule" failed | |
532 | (run with --traceback for stack trace) |
|
935 | (run with --traceback for stack trace) | |
533 | [255] |
|
936 | [255] | |
534 |
|
937 | |||
535 | $ echo '[hooks]' > ../a/.hg/hgrc |
|
938 | $ echo '[hooks]' > ../a/.hg/hgrc | |
536 | $ echo 'preoutgoing.unreachable = python:hooktests.container.unreachable' >> ../a/.hg/hgrc |
|
939 | $ echo 'preoutgoing.unreachable = python:hooktests.container.unreachable' >> ../a/.hg/hgrc | |
537 | $ hg pull ../a |
|
940 | $ hg pull ../a | |
538 | pulling from ../a |
|
941 | pulling from ../a | |
539 | searching for changes |
|
942 | searching for changes | |
540 | abort: preoutgoing.unreachable hook is invalid: import of "hooktests.container" failed |
|
943 | abort: preoutgoing.unreachable hook is invalid: import of "hooktests.container" failed | |
541 | (run with --traceback for stack trace) |
|
944 | (run with --traceback for stack trace) | |
542 | [255] |
|
945 | [255] | |
543 |
|
946 | |||
544 | $ echo '[hooks]' > ../a/.hg/hgrc |
|
947 | $ echo '[hooks]' > ../a/.hg/hgrc | |
545 | $ echo 'preoutgoing.syntaxerror = python:syntaxerror.syntaxerror' >> ../a/.hg/hgrc |
|
948 | $ echo 'preoutgoing.syntaxerror = python:syntaxerror.syntaxerror' >> ../a/.hg/hgrc | |
546 | $ hg pull ../a |
|
949 | $ hg pull ../a | |
547 | pulling from ../a |
|
950 | pulling from ../a | |
548 | searching for changes |
|
951 | searching for changes | |
549 | abort: preoutgoing.syntaxerror hook is invalid: import of "syntaxerror" failed |
|
952 | abort: preoutgoing.syntaxerror hook is invalid: import of "syntaxerror" failed | |
550 | (run with --traceback for stack trace) |
|
953 | (run with --traceback for stack trace) | |
551 | [255] |
|
954 | [255] | |
552 |
|
955 | |||
553 | The second egrep is to filter out lines like ' ^', which are slightly |
|
956 | The second egrep is to filter out lines like ' ^', which are slightly | |
554 | different between Python 2.6 and Python 2.7. |
|
957 | different between Python 2.6 and Python 2.7. | |
555 | $ hg pull ../a --traceback 2>&1 | egrep -v '^( +File| [_a-zA-Z*(])' | egrep -v '^( )+(\^)?$' |
|
958 | $ hg pull ../a --traceback 2>&1 | egrep -v '^( +File| [_a-zA-Z*(])' | egrep -v '^( )+(\^)?$' | |
556 | pulling from ../a |
|
959 | pulling from ../a | |
557 | searching for changes |
|
960 | searching for changes | |
558 | exception from first failed import attempt: |
|
961 | exception from first failed import attempt: | |
559 | Traceback (most recent call last): |
|
962 | Traceback (most recent call last): | |
560 | SyntaxError: * (glob) |
|
963 | SyntaxError: * (glob) | |
561 | exception from second failed import attempt: |
|
964 | exception from second failed import attempt: | |
562 | Traceback (most recent call last): |
|
965 | Traceback (most recent call last): | |
563 | ImportError: No module named hgext_syntaxerror |
|
966 | ImportError: No module named hgext_syntaxerror | |
564 | Traceback (most recent call last): |
|
967 | Traceback (most recent call last): | |
565 | HookLoadError: preoutgoing.syntaxerror hook is invalid: import of "syntaxerror" failed |
|
968 | HookLoadError: preoutgoing.syntaxerror hook is invalid: import of "syntaxerror" failed | |
566 | abort: preoutgoing.syntaxerror hook is invalid: import of "syntaxerror" failed |
|
969 | abort: preoutgoing.syntaxerror hook is invalid: import of "syntaxerror" failed | |
567 |
|
970 | |||
568 | $ echo '[hooks]' > ../a/.hg/hgrc |
|
971 | $ echo '[hooks]' > ../a/.hg/hgrc | |
569 | $ echo 'preoutgoing.pass = python:hooktests.passhook' >> ../a/.hg/hgrc |
|
972 | $ echo 'preoutgoing.pass = python:hooktests.passhook' >> ../a/.hg/hgrc | |
570 | $ hg pull ../a |
|
973 | $ hg pull ../a | |
571 | pulling from ../a |
|
974 | pulling from ../a | |
572 | searching for changes |
|
975 | searching for changes | |
573 | hook args: |
|
976 | hook args: | |
574 | hooktype preoutgoing |
|
977 | hooktype preoutgoing | |
575 | source pull |
|
978 | source pull | |
576 | adding changesets |
|
979 | adding changesets | |
577 | adding manifests |
|
980 | adding manifests | |
578 | adding file changes |
|
981 | adding file changes | |
579 | added 1 changesets with 1 changes to 1 files |
|
982 | added 1 changesets with 1 changes to 1 files | |
580 | adding remote bookmark quux |
|
983 | adding remote bookmark quux | |
581 | new changesets 539e4b31b6dc |
|
984 | new changesets 539e4b31b6dc | |
582 | (run 'hg update' to get a working copy) |
|
985 | (run 'hg update' to get a working copy) | |
583 |
|
986 | |||
584 | post- python hooks that fail to *run* don't cause an abort |
|
987 | post- python hooks that fail to *run* don't cause an abort | |
585 | $ rm ../a/.hg/hgrc |
|
988 | $ rm ../a/.hg/hgrc | |
586 | $ echo '[hooks]' > .hg/hgrc |
|
989 | $ echo '[hooks]' > .hg/hgrc | |
587 | $ echo 'post-pull.broken = python:hooktests.brokenhook' >> .hg/hgrc |
|
990 | $ echo 'post-pull.broken = python:hooktests.brokenhook' >> .hg/hgrc | |
588 | $ hg pull ../a |
|
991 | $ hg pull ../a | |
589 | pulling from ../a |
|
992 | pulling from ../a | |
590 | searching for changes |
|
993 | searching for changes | |
591 | no changes found |
|
994 | no changes found | |
592 | error: post-pull.broken hook raised an exception: unsupported operand type(s) for +: 'int' and 'dict' |
|
995 | error: post-pull.broken hook raised an exception: unsupported operand type(s) for +: 'int' and 'dict' | |
593 | (run with --traceback for stack trace) |
|
996 | (run with --traceback for stack trace) | |
594 |
|
997 | |||
595 | but post- python hooks that fail to *load* do |
|
998 | but post- python hooks that fail to *load* do | |
596 | $ echo '[hooks]' > .hg/hgrc |
|
999 | $ echo '[hooks]' > .hg/hgrc | |
597 | $ echo 'post-pull.nomodule = python:nomodule' >> .hg/hgrc |
|
1000 | $ echo 'post-pull.nomodule = python:nomodule' >> .hg/hgrc | |
598 | $ hg pull ../a |
|
1001 | $ hg pull ../a | |
599 | pulling from ../a |
|
1002 | pulling from ../a | |
600 | searching for changes |
|
1003 | searching for changes | |
601 | no changes found |
|
1004 | no changes found | |
602 | abort: post-pull.nomodule hook is invalid: "nomodule" not in a module |
|
1005 | abort: post-pull.nomodule hook is invalid: "nomodule" not in a module | |
603 | [255] |
|
1006 | [255] | |
604 |
|
1007 | |||
605 | $ echo '[hooks]' > .hg/hgrc |
|
1008 | $ echo '[hooks]' > .hg/hgrc | |
606 | $ echo 'post-pull.badmodule = python:nomodule.nowhere' >> .hg/hgrc |
|
1009 | $ echo 'post-pull.badmodule = python:nomodule.nowhere' >> .hg/hgrc | |
607 | $ hg pull ../a |
|
1010 | $ hg pull ../a | |
608 | pulling from ../a |
|
1011 | pulling from ../a | |
609 | searching for changes |
|
1012 | searching for changes | |
610 | no changes found |
|
1013 | no changes found | |
611 | abort: post-pull.badmodule hook is invalid: import of "nomodule" failed |
|
1014 | abort: post-pull.badmodule hook is invalid: import of "nomodule" failed | |
612 | (run with --traceback for stack trace) |
|
1015 | (run with --traceback for stack trace) | |
613 | [255] |
|
1016 | [255] | |
614 |
|
1017 | |||
615 | $ echo '[hooks]' > .hg/hgrc |
|
1018 | $ echo '[hooks]' > .hg/hgrc | |
616 | $ echo 'post-pull.nohook = python:hooktests.nohook' >> .hg/hgrc |
|
1019 | $ echo 'post-pull.nohook = python:hooktests.nohook' >> .hg/hgrc | |
617 | $ hg pull ../a |
|
1020 | $ hg pull ../a | |
618 | pulling from ../a |
|
1021 | pulling from ../a | |
619 | searching for changes |
|
1022 | searching for changes | |
620 | no changes found |
|
1023 | no changes found | |
621 | abort: post-pull.nohook hook is invalid: "hooktests.nohook" is not defined |
|
1024 | abort: post-pull.nohook hook is invalid: "hooktests.nohook" is not defined | |
622 | [255] |
|
1025 | [255] | |
623 |
|
1026 | |||
624 | make sure --traceback works |
|
1027 | make sure --traceback works | |
625 |
|
1028 | |||
626 | $ echo '[hooks]' > .hg/hgrc |
|
1029 | $ echo '[hooks]' > .hg/hgrc | |
627 | $ echo 'commit.abort = python:hooktests.aborthook' >> .hg/hgrc |
|
1030 | $ echo 'commit.abort = python:hooktests.aborthook' >> .hg/hgrc | |
628 |
|
1031 | |||
629 | $ echo aa > a |
|
1032 | $ echo aa > a | |
630 | $ hg --traceback commit -d '0 0' -ma 2>&1 | grep '^Traceback' |
|
1033 | $ hg --traceback commit -d '0 0' -ma 2>&1 | grep '^Traceback' | |
631 | Traceback (most recent call last): |
|
1034 | Traceback (most recent call last): | |
632 |
|
1035 | |||
633 | $ cd .. |
|
1036 | $ cd .. | |
634 | $ hg init c |
|
1037 | $ hg init c | |
635 | $ cd c |
|
1038 | $ cd c | |
636 |
|
1039 | |||
637 | $ cat > hookext.py <<EOF |
|
1040 | $ cat > hookext.py <<EOF | |
638 | > def autohook(ui, **args): |
|
1041 | > def autohook(ui, **args): | |
639 | > ui.write(b'Automatically installed hook\n') |
|
1042 | > ui.write(b'Automatically installed hook\n') | |
640 | > |
|
1043 | > | |
641 | > def reposetup(ui, repo): |
|
1044 | > def reposetup(ui, repo): | |
642 | > repo.ui.setconfig(b"hooks", b"commit.auto", autohook) |
|
1045 | > repo.ui.setconfig(b"hooks", b"commit.auto", autohook) | |
643 | > EOF |
|
1046 | > EOF | |
644 | $ echo '[extensions]' >> .hg/hgrc |
|
1047 | $ echo '[extensions]' >> .hg/hgrc | |
645 | $ echo 'hookext = hookext.py' >> .hg/hgrc |
|
1048 | $ echo 'hookext = hookext.py' >> .hg/hgrc | |
646 |
|
1049 | |||
647 | $ touch foo |
|
1050 | $ touch foo | |
648 | $ hg add foo |
|
1051 | $ hg add foo | |
649 | $ hg ci -d '0 0' -m 'add foo' |
|
1052 | $ hg ci -d '0 0' -m 'add foo' | |
650 | Automatically installed hook |
|
1053 | Automatically installed hook | |
651 | $ echo >> foo |
|
1054 | $ echo >> foo | |
652 | $ hg ci --debug -d '0 0' -m 'change foo' |
|
1055 | $ hg ci --debug -d '0 0' -m 'change foo' | |
653 | committing files: |
|
1056 | committing files: | |
654 | foo |
|
1057 | foo | |
655 | committing manifest |
|
1058 | committing manifest | |
656 | committing changelog |
|
1059 | committing changelog | |
657 | updating the branch cache |
|
1060 | updating the branch cache | |
658 | committed changeset 1:52998019f6252a2b893452765fcb0a47351a5708 |
|
1061 | committed changeset 1:52998019f6252a2b893452765fcb0a47351a5708 | |
659 | calling hook commit.auto: hgext_hookext.autohook |
|
1062 | calling hook commit.auto: hgext_hookext.autohook | |
660 | Automatically installed hook |
|
1063 | Automatically installed hook | |
661 |
|
1064 | |||
662 | $ hg showconfig hooks |
|
1065 | $ hg showconfig hooks | |
663 | hooks.commit.auto=<function autohook at *> (glob) |
|
1066 | hooks.commit.auto=<function autohook at *> (glob) | |
664 |
|
1067 | |||
665 | test python hook configured with python:[file]:[hook] syntax |
|
1068 | test python hook configured with python:[file]:[hook] syntax | |
666 |
|
1069 | |||
667 | $ cd .. |
|
1070 | $ cd .. | |
668 | $ mkdir d |
|
1071 | $ mkdir d | |
669 | $ cd d |
|
1072 | $ cd d | |
670 | $ hg init repo |
|
1073 | $ hg init repo | |
671 | $ mkdir hooks |
|
1074 | $ mkdir hooks | |
672 |
|
1075 | |||
673 | $ cd hooks |
|
1076 | $ cd hooks | |
674 | $ cat > testhooks.py <<EOF |
|
1077 | $ cat > testhooks.py <<EOF | |
675 | > def testhook(ui, **args): |
|
1078 | > def testhook(ui, **args): | |
676 | > ui.write(b'hook works\n') |
|
1079 | > ui.write(b'hook works\n') | |
677 | > EOF |
|
1080 | > EOF | |
678 | $ echo '[hooks]' > ../repo/.hg/hgrc |
|
1081 | $ echo '[hooks]' > ../repo/.hg/hgrc | |
679 | $ echo "pre-commit.test = python:`pwd`/testhooks.py:testhook" >> ../repo/.hg/hgrc |
|
1082 | $ echo "pre-commit.test = python:`pwd`/testhooks.py:testhook" >> ../repo/.hg/hgrc | |
680 |
|
1083 | |||
681 | $ cd ../repo |
|
1084 | $ cd ../repo | |
682 | $ hg commit -d '0 0' |
|
1085 | $ hg commit -d '0 0' | |
683 | hook works |
|
1086 | hook works | |
684 | nothing changed |
|
1087 | nothing changed | |
685 | [1] |
|
1088 | [1] | |
686 |
|
1089 | |||
687 | $ echo '[hooks]' > .hg/hgrc |
|
1090 | $ echo '[hooks]' > .hg/hgrc | |
688 | $ echo "update.ne = python:`pwd`/nonexistent.py:testhook" >> .hg/hgrc |
|
1091 | $ echo "update.ne = python:`pwd`/nonexistent.py:testhook" >> .hg/hgrc | |
689 | $ echo "pre-identify.npmd = python:`pwd`/:no_python_module_dir" >> .hg/hgrc |
|
1092 | $ echo "pre-identify.npmd = python:`pwd`/:no_python_module_dir" >> .hg/hgrc | |
690 |
|
1093 | |||
691 | $ hg up null |
|
1094 | $ hg up null | |
692 | loading update.ne hook failed: |
|
1095 | loading update.ne hook failed: | |
693 | abort: $ENOENT$: '$TESTTMP/d/repo/nonexistent.py' |
|
1096 | abort: $ENOENT$: '$TESTTMP/d/repo/nonexistent.py' | |
694 | [255] |
|
1097 | [255] | |
695 |
|
1098 | |||
696 | $ hg id |
|
1099 | $ hg id | |
697 | loading pre-identify.npmd hook failed: |
|
1100 | loading pre-identify.npmd hook failed: | |
698 | abort: No module named repo! |
|
1101 | abort: No module named repo! | |
699 | [255] |
|
1102 | [255] | |
700 |
|
1103 | |||
701 | $ cd ../../b |
|
1104 | $ cd ../../b | |
702 |
|
1105 | |||
703 | make sure --traceback works on hook import failure |
|
1106 | make sure --traceback works on hook import failure | |
704 |
|
1107 | |||
705 | $ cat > importfail.py <<EOF |
|
1108 | $ cat > importfail.py <<EOF | |
706 | > import somebogusmodule |
|
1109 | > import somebogusmodule | |
707 | > # dereference something in the module to force demandimport to load it |
|
1110 | > # dereference something in the module to force demandimport to load it | |
708 | > somebogusmodule.whatever |
|
1111 | > somebogusmodule.whatever | |
709 | > EOF |
|
1112 | > EOF | |
710 |
|
1113 | |||
711 | $ echo '[hooks]' > .hg/hgrc |
|
1114 | $ echo '[hooks]' > .hg/hgrc | |
712 | $ echo 'precommit.importfail = python:importfail.whatever' >> .hg/hgrc |
|
1115 | $ echo 'precommit.importfail = python:importfail.whatever' >> .hg/hgrc | |
713 |
|
1116 | |||
714 | $ echo a >> a |
|
1117 | $ echo a >> a | |
715 | $ hg --traceback commit -ma 2>&1 | egrep -v '^( +File| [a-zA-Z(])' |
|
1118 | $ hg --traceback commit -ma 2>&1 | egrep -v '^( +File| [a-zA-Z(])' | |
716 | exception from first failed import attempt: |
|
1119 | exception from first failed import attempt: | |
717 | Traceback (most recent call last): |
|
1120 | Traceback (most recent call last): | |
718 | ImportError: No module named somebogusmodule |
|
1121 | ImportError: No module named somebogusmodule | |
719 | exception from second failed import attempt: |
|
1122 | exception from second failed import attempt: | |
720 | Traceback (most recent call last): |
|
1123 | Traceback (most recent call last): | |
721 | ImportError: No module named hgext_importfail |
|
1124 | ImportError: No module named hgext_importfail | |
722 | Traceback (most recent call last): |
|
1125 | Traceback (most recent call last): | |
723 | HookLoadError: precommit.importfail hook is invalid: import of "importfail" failed |
|
1126 | HookLoadError: precommit.importfail hook is invalid: import of "importfail" failed | |
724 | abort: precommit.importfail hook is invalid: import of "importfail" failed |
|
1127 | abort: precommit.importfail hook is invalid: import of "importfail" failed | |
725 |
|
1128 | |||
726 | Issue1827: Hooks Update & Commit not completely post operation |
|
1129 | Issue1827: Hooks Update & Commit not completely post operation | |
727 |
|
1130 | |||
728 | commit and update hooks should run after command completion. The largefiles |
|
1131 | commit and update hooks should run after command completion. The largefiles | |
729 | use demonstrates a recursive wlock, showing the hook doesn't run until the |
|
1132 | use demonstrates a recursive wlock, showing the hook doesn't run until the | |
730 | final release (and dirstate flush). |
|
1133 | final release (and dirstate flush). | |
731 |
|
1134 | |||
732 | $ echo '[hooks]' > .hg/hgrc |
|
1135 | $ echo '[hooks]' > .hg/hgrc | |
733 | $ echo 'commit = hg id' >> .hg/hgrc |
|
1136 | $ echo 'commit = hg id' >> .hg/hgrc | |
734 | $ echo 'update = hg id' >> .hg/hgrc |
|
1137 | $ echo 'update = hg id' >> .hg/hgrc | |
735 | $ echo bb > a |
|
1138 | $ echo bb > a | |
736 | $ hg ci -ma |
|
1139 | $ hg ci -ma | |
737 | 223eafe2750c tip |
|
1140 | 223eafe2750c tip | |
738 | $ hg up 0 --config extensions.largefiles= |
|
1141 | $ hg up 0 --config extensions.largefiles= | |
739 | The fsmonitor extension is incompatible with the largefiles extension and has been disabled. (fsmonitor !) |
|
1142 | The fsmonitor extension is incompatible with the largefiles extension and has been disabled. (fsmonitor !) | |
740 | cb9a9f314b8b |
|
1143 | cb9a9f314b8b | |
741 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1144 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
742 |
|
1145 | |||
743 | make sure --verbose (and --quiet/--debug etc.) are propagated to the local ui |
|
1146 | make sure --verbose (and --quiet/--debug etc.) are propagated to the local ui | |
744 | that is passed to pre/post hooks |
|
1147 | that is passed to pre/post hooks | |
745 |
|
1148 | |||
746 | $ echo '[hooks]' > .hg/hgrc |
|
1149 | $ echo '[hooks]' > .hg/hgrc | |
747 | $ echo 'pre-identify = python:hooktests.verbosehook' >> .hg/hgrc |
|
1150 | $ echo 'pre-identify = python:hooktests.verbosehook' >> .hg/hgrc | |
748 | $ hg id |
|
1151 | $ hg id | |
749 | cb9a9f314b8b |
|
1152 | cb9a9f314b8b | |
750 | $ hg id --verbose |
|
1153 | $ hg id --verbose | |
751 | calling hook pre-identify: hooktests.verbosehook |
|
1154 | calling hook pre-identify: hooktests.verbosehook | |
752 | verbose output from hook |
|
1155 | verbose output from hook | |
753 | cb9a9f314b8b |
|
1156 | cb9a9f314b8b | |
754 |
|
1157 | |||
755 | Ensure hooks can be prioritized |
|
1158 | Ensure hooks can be prioritized | |
756 |
|
1159 | |||
757 | $ echo '[hooks]' > .hg/hgrc |
|
1160 | $ echo '[hooks]' > .hg/hgrc | |
758 | $ echo 'pre-identify.a = python:hooktests.verbosehook' >> .hg/hgrc |
|
1161 | $ echo 'pre-identify.a = python:hooktests.verbosehook' >> .hg/hgrc | |
759 | $ echo 'pre-identify.b = python:hooktests.verbosehook' >> .hg/hgrc |
|
1162 | $ echo 'pre-identify.b = python:hooktests.verbosehook' >> .hg/hgrc | |
760 | $ echo 'priority.pre-identify.b = 1' >> .hg/hgrc |
|
1163 | $ echo 'priority.pre-identify.b = 1' >> .hg/hgrc | |
761 | $ echo 'pre-identify.c = python:hooktests.verbosehook' >> .hg/hgrc |
|
1164 | $ echo 'pre-identify.c = python:hooktests.verbosehook' >> .hg/hgrc | |
762 | $ hg id --verbose |
|
1165 | $ hg id --verbose | |
763 | calling hook pre-identify.b: hooktests.verbosehook |
|
1166 | calling hook pre-identify.b: hooktests.verbosehook | |
764 | verbose output from hook |
|
1167 | verbose output from hook | |
765 | calling hook pre-identify.a: hooktests.verbosehook |
|
1168 | calling hook pre-identify.a: hooktests.verbosehook | |
766 | verbose output from hook |
|
1169 | verbose output from hook | |
767 | calling hook pre-identify.c: hooktests.verbosehook |
|
1170 | calling hook pre-identify.c: hooktests.verbosehook | |
768 | verbose output from hook |
|
1171 | verbose output from hook | |
769 | cb9a9f314b8b |
|
1172 | cb9a9f314b8b | |
770 |
|
1173 | |||
771 | new tags must be visible in pretxncommit (issue3210) |
|
1174 | new tags must be visible in pretxncommit (issue3210) | |
772 |
|
1175 | |||
773 | $ echo 'pretxncommit.printtags = python:hooktests.printtags' >> .hg/hgrc |
|
1176 | $ echo 'pretxncommit.printtags = python:hooktests.printtags' >> .hg/hgrc | |
774 | $ hg tag -f foo |
|
1177 | $ hg tag -f foo | |
775 | [a, foo, tip] |
|
1178 | [a, foo, tip] | |
776 |
|
1179 | |||
777 | post-init hooks must not crash (issue4983) |
|
1180 | post-init hooks must not crash (issue4983) | |
778 | This also creates the `to` repo for the next test block. |
|
1181 | This also creates the `to` repo for the next test block. | |
779 |
|
1182 | |||
780 | $ cd .. |
|
1183 | $ cd .. | |
781 | $ cat << EOF >> hgrc-with-post-init-hook |
|
1184 | $ cat << EOF >> hgrc-with-post-init-hook | |
782 | > [hooks] |
|
1185 | > [hooks] | |
783 | > post-init = sh -c "printenv.py post-init" |
|
1186 | > post-init = sh -c "printenv.py --line post-init" | |
784 | > EOF |
|
1187 | > EOF | |
785 | $ HGRCPATH=hgrc-with-post-init-hook hg init to |
|
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 | new commits must be visible in pretxnchangegroup (issue3428) |
|
1197 | new commits must be visible in pretxnchangegroup (issue3428) | |
789 |
|
1198 | |||
790 | $ echo '[hooks]' >> to/.hg/hgrc |
|
1199 | $ echo '[hooks]' >> to/.hg/hgrc | |
791 | $ echo 'prechangegroup = hg --traceback tip' >> to/.hg/hgrc |
|
1200 | $ echo 'prechangegroup = hg --traceback tip' >> to/.hg/hgrc | |
792 | $ echo 'pretxnchangegroup = hg --traceback tip' >> to/.hg/hgrc |
|
1201 | $ echo 'pretxnchangegroup = hg --traceback tip' >> to/.hg/hgrc | |
793 | $ echo a >> to/a |
|
1202 | $ echo a >> to/a | |
794 | $ hg --cwd to ci -Ama |
|
1203 | $ hg --cwd to ci -Ama | |
795 | adding a |
|
1204 | adding a | |
796 | $ hg clone to from |
|
1205 | $ hg clone to from | |
797 | updating to branch default |
|
1206 | updating to branch default | |
798 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1207 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
799 | $ echo aa >> from/a |
|
1208 | $ echo aa >> from/a | |
800 | $ hg --cwd from ci -mb |
|
1209 | $ hg --cwd from ci -mb | |
801 | $ hg --cwd from push |
|
1210 | $ hg --cwd from push | |
802 | pushing to $TESTTMP/to |
|
1211 | pushing to $TESTTMP/to | |
803 | searching for changes |
|
1212 | searching for changes | |
804 | changeset: 0:cb9a9f314b8b |
|
1213 | changeset: 0:cb9a9f314b8b | |
805 | tag: tip |
|
1214 | tag: tip | |
806 | user: test |
|
1215 | user: test | |
807 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1216 | date: Thu Jan 01 00:00:00 1970 +0000 | |
808 | summary: a |
|
1217 | summary: a | |
809 |
|
1218 | |||
810 | adding changesets |
|
1219 | adding changesets | |
811 | adding manifests |
|
1220 | adding manifests | |
812 | adding file changes |
|
1221 | adding file changes | |
813 | added 1 changesets with 1 changes to 1 files |
|
1222 | added 1 changesets with 1 changes to 1 files | |
814 | changeset: 1:9836a07b9b9d |
|
1223 | changeset: 1:9836a07b9b9d | |
815 | tag: tip |
|
1224 | tag: tip | |
816 | user: test |
|
1225 | user: test | |
817 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1226 | date: Thu Jan 01 00:00:00 1970 +0000 | |
818 | summary: b |
|
1227 | summary: b | |
819 |
|
1228 | |||
820 |
|
1229 | |||
821 | pretxnclose hook failure should abort the transaction |
|
1230 | pretxnclose hook failure should abort the transaction | |
822 |
|
1231 | |||
823 | $ hg init txnfailure |
|
1232 | $ hg init txnfailure | |
824 | $ cd txnfailure |
|
1233 | $ cd txnfailure | |
825 | $ touch a && hg commit -Aqm a |
|
1234 | $ touch a && hg commit -Aqm a | |
826 | $ cat >> .hg/hgrc <<EOF |
|
1235 | $ cat >> .hg/hgrc <<EOF | |
827 | > [hooks] |
|
1236 | > [hooks] | |
828 | > pretxnclose.error = exit 1 |
|
1237 | > pretxnclose.error = exit 1 | |
829 | > EOF |
|
1238 | > EOF | |
830 | $ hg strip -r 0 --config extensions.strip= |
|
1239 | $ hg strip -r 0 --config extensions.strip= | |
831 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
1240 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
832 | saved backup bundle to * (glob) |
|
1241 | saved backup bundle to * (glob) | |
833 | transaction abort! |
|
1242 | transaction abort! | |
834 | rollback completed |
|
1243 | rollback completed | |
835 | strip failed, backup bundle stored in * (glob) |
|
1244 | strip failed, backup bundle stored in * (glob) | |
836 | abort: pretxnclose.error hook exited with status 1 |
|
1245 | abort: pretxnclose.error hook exited with status 1 | |
837 | [255] |
|
1246 | [255] | |
838 | $ hg recover |
|
1247 | $ hg recover | |
839 | no interrupted transaction available |
|
1248 | no interrupted transaction available | |
840 | [1] |
|
1249 | [1] | |
841 | $ cd .. |
|
1250 | $ cd .. | |
842 |
|
1251 | |||
843 | check whether HG_PENDING makes pending changes only in related |
|
1252 | check whether HG_PENDING makes pending changes only in related | |
844 | repositories visible to an external hook. |
|
1253 | repositories visible to an external hook. | |
845 |
|
1254 | |||
846 | (emulate a transaction running concurrently by copied |
|
1255 | (emulate a transaction running concurrently by copied | |
847 | .hg/store/00changelog.i.a in subsequent test) |
|
1256 | .hg/store/00changelog.i.a in subsequent test) | |
848 |
|
1257 | |||
849 | $ cat > $TESTTMP/savepending.sh <<EOF |
|
1258 | $ cat > $TESTTMP/savepending.sh <<EOF | |
850 | > cp .hg/store/00changelog.i.a .hg/store/00changelog.i.a.saved |
|
1259 | > cp .hg/store/00changelog.i.a .hg/store/00changelog.i.a.saved | |
851 | > exit 1 # to avoid adding new revision for subsequent tests |
|
1260 | > exit 1 # to avoid adding new revision for subsequent tests | |
852 | > EOF |
|
1261 | > EOF | |
853 | $ cd a |
|
1262 | $ cd a | |
854 | $ hg tip -q |
|
1263 | $ hg tip -q | |
855 | 4:539e4b31b6dc |
|
1264 | 4:539e4b31b6dc | |
856 | $ hg --config hooks.pretxnclose="sh $TESTTMP/savepending.sh" commit -m "invisible" |
|
1265 | $ hg --config hooks.pretxnclose="sh $TESTTMP/savepending.sh" commit -m "invisible" | |
857 | transaction abort! |
|
1266 | transaction abort! | |
858 | rollback completed |
|
1267 | rollback completed | |
859 | abort: pretxnclose hook exited with status 1 |
|
1268 | abort: pretxnclose hook exited with status 1 | |
860 | [255] |
|
1269 | [255] | |
861 | $ cp .hg/store/00changelog.i.a.saved .hg/store/00changelog.i.a |
|
1270 | $ cp .hg/store/00changelog.i.a.saved .hg/store/00changelog.i.a | |
862 |
|
1271 | |||
863 | (check (in)visibility of new changeset while transaction running in |
|
1272 | (check (in)visibility of new changeset while transaction running in | |
864 | repo) |
|
1273 | repo) | |
865 |
|
1274 | |||
866 | $ cat > $TESTTMP/checkpending.sh <<EOF |
|
1275 | $ cat > $TESTTMP/checkpending.sh <<EOF | |
867 | > echo '@a' |
|
1276 | > echo '@a' | |
868 | > hg -R "$TESTTMP/a" tip -q |
|
1277 | > hg -R "$TESTTMP/a" tip -q | |
869 | > echo '@a/nested' |
|
1278 | > echo '@a/nested' | |
870 | > hg -R "$TESTTMP/a/nested" tip -q |
|
1279 | > hg -R "$TESTTMP/a/nested" tip -q | |
871 | > exit 1 # to avoid adding new revision for subsequent tests |
|
1280 | > exit 1 # to avoid adding new revision for subsequent tests | |
872 | > EOF |
|
1281 | > EOF | |
873 | $ hg init nested |
|
1282 | $ hg init nested | |
874 | $ cd nested |
|
1283 | $ cd nested | |
875 | $ echo a > a |
|
1284 | $ echo a > a | |
876 | $ hg add a |
|
1285 | $ hg add a | |
877 | $ hg --config hooks.pretxnclose="sh $TESTTMP/checkpending.sh" commit -m '#0' |
|
1286 | $ hg --config hooks.pretxnclose="sh $TESTTMP/checkpending.sh" commit -m '#0' | |
878 | @a |
|
1287 | @a | |
879 | 4:539e4b31b6dc |
|
1288 | 4:539e4b31b6dc | |
880 | @a/nested |
|
1289 | @a/nested | |
881 | 0:bf5e395ced2c |
|
1290 | 0:bf5e395ced2c | |
882 | transaction abort! |
|
1291 | transaction abort! | |
883 | rollback completed |
|
1292 | rollback completed | |
884 | abort: pretxnclose hook exited with status 1 |
|
1293 | abort: pretxnclose hook exited with status 1 | |
885 | [255] |
|
1294 | [255] | |
886 |
|
1295 | |||
887 | Hook from untrusted hgrc are reported as failure |
|
1296 | Hook from untrusted hgrc are reported as failure | |
888 | ================================================ |
|
1297 | ================================================ | |
889 |
|
1298 | |||
890 | $ cat << EOF > $TESTTMP/untrusted.py |
|
1299 | $ cat << EOF > $TESTTMP/untrusted.py | |
891 | > from mercurial import scmutil, util |
|
1300 | > from mercurial import scmutil, util | |
892 | > def uisetup(ui): |
|
1301 | > def uisetup(ui): | |
893 | > class untrustedui(ui.__class__): |
|
1302 | > class untrustedui(ui.__class__): | |
894 | > def _trusted(self, fp, f): |
|
1303 | > def _trusted(self, fp, f): | |
895 | > if util.normpath(fp.name).endswith(b'untrusted/.hg/hgrc'): |
|
1304 | > if util.normpath(fp.name).endswith(b'untrusted/.hg/hgrc'): | |
896 | > return False |
|
1305 | > return False | |
897 | > return super(untrustedui, self)._trusted(fp, f) |
|
1306 | > return super(untrustedui, self)._trusted(fp, f) | |
898 | > ui.__class__ = untrustedui |
|
1307 | > ui.__class__ = untrustedui | |
899 | > EOF |
|
1308 | > EOF | |
900 | $ cat << EOF >> $HGRCPATH |
|
1309 | $ cat << EOF >> $HGRCPATH | |
901 | > [extensions] |
|
1310 | > [extensions] | |
902 | > untrusted=$TESTTMP/untrusted.py |
|
1311 | > untrusted=$TESTTMP/untrusted.py | |
903 | > EOF |
|
1312 | > EOF | |
904 | $ hg init untrusted |
|
1313 | $ hg init untrusted | |
905 | $ cd untrusted |
|
1314 | $ cd untrusted | |
906 |
|
1315 | |||
907 | Non-blocking hook |
|
1316 | Non-blocking hook | |
908 | ----------------- |
|
1317 | ----------------- | |
909 |
|
1318 | |||
910 | $ cat << EOF >> .hg/hgrc |
|
1319 | $ cat << EOF >> .hg/hgrc | |
911 | > [hooks] |
|
1320 | > [hooks] | |
912 | > txnclose.testing=echo txnclose hook called |
|
1321 | > txnclose.testing=echo txnclose hook called | |
913 | > EOF |
|
1322 | > EOF | |
914 | $ touch a && hg commit -Aqm a |
|
1323 | $ touch a && hg commit -Aqm a | |
915 | warning: untrusted hook txnclose.testing not executed |
|
1324 | warning: untrusted hook txnclose.testing not executed | |
916 | $ hg log |
|
1325 | $ hg log | |
917 | changeset: 0:3903775176ed |
|
1326 | changeset: 0:3903775176ed | |
918 | tag: tip |
|
1327 | tag: tip | |
919 | user: test |
|
1328 | user: test | |
920 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1329 | date: Thu Jan 01 00:00:00 1970 +0000 | |
921 | summary: a |
|
1330 | summary: a | |
922 |
|
1331 | |||
923 |
|
1332 | |||
924 | Non-blocking hook |
|
1333 | Non-blocking hook | |
925 | ----------------- |
|
1334 | ----------------- | |
926 |
|
1335 | |||
927 | $ cat << EOF >> .hg/hgrc |
|
1336 | $ cat << EOF >> .hg/hgrc | |
928 | > [hooks] |
|
1337 | > [hooks] | |
929 | > pretxnclose.testing=echo pre-txnclose hook called |
|
1338 | > pretxnclose.testing=echo pre-txnclose hook called | |
930 | > EOF |
|
1339 | > EOF | |
931 | $ touch b && hg commit -Aqm a |
|
1340 | $ touch b && hg commit -Aqm a | |
932 | transaction abort! |
|
1341 | transaction abort! | |
933 | rollback completed |
|
1342 | rollback completed | |
934 | abort: untrusted hook pretxnclose.testing not executed |
|
1343 | abort: untrusted hook pretxnclose.testing not executed | |
935 | (see 'hg help config.trusted') |
|
1344 | (see 'hg help config.trusted') | |
936 | [255] |
|
1345 | [255] | |
937 | $ hg log |
|
1346 | $ hg log | |
938 | changeset: 0:3903775176ed |
|
1347 | changeset: 0:3903775176ed | |
939 | tag: tip |
|
1348 | tag: tip | |
940 | user: test |
|
1349 | user: test | |
941 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1350 | date: Thu Jan 01 00:00:00 1970 +0000 | |
942 | summary: a |
|
1351 | summary: a | |
943 |
|
1352 |
General Comments 0
You need to be logged in to leave comments.
Login now