Show More
@@ -1,5 +1,15 b'' | |||
|
1 | 1 | #require killdaemons |
|
2 | 2 | |
|
3 | #testcases bundle1 bundle2 | |
|
4 | ||
|
5 | #if bundle1 | |
|
6 | $ cat << EOF >> $HGRCPATH | |
|
7 | > [devel] | |
|
8 | > # This test is dedicated to interaction through old bundle | |
|
9 | > legacy.exchange = bundle1 | |
|
10 | > EOF | |
|
11 | #endif | |
|
12 | ||
|
3 | 13 |
$ |
|
4 | 14 | $ cd test |
|
5 | 15 | $ echo a > a |
@@ -76,7 +86,8 b' expect success' | |||
|
76 | 86 | remote: added 1 changesets with 1 changes to 1 files |
|
77 | 87 | remote: phase-move: cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b: draft -> public |
|
78 | 88 | remote: phase-move: ba677d0156c1196c1a699fa53f390dcfc3ce3872: -> public |
|
79 |
remote: changegroup hook: |
|
|
89 | remote: changegroup hook: HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_NODE_LAST=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_SOURCE=serve HG_TXNID=TXN:$ID$ HG_URL=remote:http:$LOCALIP: (glob) (bundle1 !) | |
|
90 | remote: changegroup hook: HG_BUNDLE2=1 HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_NODE_LAST=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_SOURCE=serve HG_TXNID=TXN:$ID$ HG_URL=remote:http:$LOCALIP: (glob) (bundle2 !) | |
|
80 | 91 | % serve errors |
|
81 | 92 | $ hg rollback |
|
82 | 93 | repository tip rolled back to revision 0 (undo serve) |
@@ -94,7 +105,8 b' expect success, server lacks the httphea' | |||
|
94 | 105 | remote: added 1 changesets with 1 changes to 1 files |
|
95 | 106 | remote: phase-move: cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b: draft -> public |
|
96 | 107 | remote: phase-move: ba677d0156c1196c1a699fa53f390dcfc3ce3872: -> public |
|
97 |
remote: changegroup hook: |
|
|
108 | remote: changegroup hook: HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_NODE_LAST=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_SOURCE=serve HG_TXNID=TXN:$ID$ HG_URL=remote:http:$LOCALIP: (glob) (bundle1 !) | |
|
109 | remote: changegroup hook: HG_BUNDLE2=1 HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_NODE_LAST=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_SOURCE=serve HG_TXNID=TXN:$ID$ HG_URL=remote:http:$LOCALIP: (glob) (bundle2 !) | |
|
98 | 110 | % serve errors |
|
99 | 111 | $ hg rollback |
|
100 | 112 | repository tip rolled back to revision 0 (undo serve) |
@@ -112,12 +124,45 b' expect success, server lacks the unbundl' | |||
|
112 | 124 | remote: added 1 changesets with 1 changes to 1 files |
|
113 | 125 | remote: phase-move: cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b: draft -> public |
|
114 | 126 | remote: phase-move: ba677d0156c1196c1a699fa53f390dcfc3ce3872: -> public |
|
115 |
remote: changegroup hook: |
|
|
127 | remote: changegroup hook: HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_NODE_LAST=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_SOURCE=serve HG_TXNID=TXN:$ID$ HG_URL=remote:http:$LOCALIP: (glob) (bundle1 !) | |
|
128 | remote: changegroup hook: HG_BUNDLE2=1 HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_NODE_LAST=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_SOURCE=serve HG_TXNID=TXN:$ID$ HG_URL=remote:http:$LOCALIP: (glob) (bundle2 !) | |
|
116 | 129 | % serve errors |
|
117 | 130 | $ hg rollback |
|
118 | 131 | repository tip rolled back to revision 0 (undo serve) |
|
119 | 132 | |
|
120 | expect push success, phase change failure | |
|
133 | expect success, pre-d1b16a746db6 server supports the unbundle capability, but | |
|
134 | has no parameter | |
|
135 | ||
|
136 | $ cat <<EOF > notcapable-unbundleparam.py | |
|
137 | > from mercurial import extensions, httppeer | |
|
138 | > def capable(orig, self, name): | |
|
139 | > if name == 'unbundle': | |
|
140 | > return True | |
|
141 | > return orig(self, name) | |
|
142 | > def uisetup(ui): | |
|
143 | > extensions.wrapfunction(httppeer.httppeer, 'capable', capable) | |
|
144 | > EOF | |
|
145 | $ cp $HGRCPATH $HGRCPATH.orig | |
|
146 | $ cat <<EOF >> $HGRCPATH | |
|
147 | > [extensions] | |
|
148 | > notcapable-unbundleparam = `pwd`/notcapable-unbundleparam.py | |
|
149 | > EOF | |
|
150 | $ req | |
|
151 | pushing to http://localhost:$HGPORT/ | |
|
152 | searching for changes | |
|
153 | remote: adding changesets | |
|
154 | remote: adding manifests | |
|
155 | remote: adding file changes | |
|
156 | remote: added 1 changesets with 1 changes to 1 files | |
|
157 | remote: phase-move: cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b: draft -> public | |
|
158 | remote: phase-move: ba677d0156c1196c1a699fa53f390dcfc3ce3872: -> public | |
|
159 | remote: changegroup hook: * (glob) | |
|
160 | % serve errors | |
|
161 | $ hg rollback | |
|
162 | repository tip rolled back to revision 0 (undo serve) | |
|
163 | $ mv $HGRCPATH.orig $HGRCPATH | |
|
164 | ||
|
165 | Test pushing to a publishing repository with a failing prepushkey hook | |
|
121 | 166 | |
|
122 | 167 | $ cat > .hg/hgrc <<EOF |
|
123 | 168 | > [web] |
@@ -128,6 +173,27 b' expect push success, phase change failur' | |||
|
128 | 173 | > [devel] |
|
129 | 174 | > legacy.exchange=phases |
|
130 | 175 | > EOF |
|
176 | ||
|
177 | #if bundle1 | |
|
178 | Bundle1 works because a) phases are updated as part of changegroup application | |
|
179 | and b) client checks phases after the "unbundle" command. Since it sees no | |
|
180 | phase changes are necessary, it doesn't send the "pushkey" command and the | |
|
181 | prepushkey hook never has to fire. | |
|
182 | ||
|
183 | $ req | |
|
184 | pushing to http://localhost:$HGPORT/ | |
|
185 | searching for changes | |
|
186 | remote: adding changesets | |
|
187 | remote: adding manifests | |
|
188 | remote: adding file changes | |
|
189 | remote: added 1 changesets with 1 changes to 1 files | |
|
190 | % serve errors | |
|
191 | ||
|
192 | #endif | |
|
193 | ||
|
194 | #if bundle2 | |
|
195 | Bundle2 sends a "pushkey" bundle2 part. This runs as part of the transaction | |
|
196 | and fails the entire push. | |
|
131 | 197 | $ req |
|
132 | 198 | pushing to http://localhost:$HGPORT/ |
|
133 | 199 | searching for changes |
@@ -143,13 +209,42 b' expect push success, phase change failur' | |||
|
143 | 209 | % serve errors |
|
144 | 210 | [255] |
|
145 | 211 | |
|
146 | expect phase change success | |
|
212 | #endif | |
|
213 | ||
|
214 | Now remove the failing prepushkey hook. | |
|
147 | 215 | |
|
148 | 216 | $ cat >> .hg/hgrc <<EOF |
|
217 | > [hooks] | |
|
149 | 218 | > prepushkey = sh -c "printenv.py prepushkey 0" |
|
150 | > [devel] | |
|
151 | > legacy.exchange= | |
|
152 | 219 | > EOF |
|
220 | ||
|
221 | We don't need to test bundle1 because it succeeded above. | |
|
222 | ||
|
223 | #if bundle2 | |
|
224 | $ req | |
|
225 | pushing to http://localhost:$HGPORT/ | |
|
226 | searching for changes | |
|
227 | remote: adding changesets | |
|
228 | remote: adding manifests | |
|
229 | remote: adding file changes | |
|
230 | remote: added 1 changesets with 1 changes to 1 files | |
|
231 | remote: prepushkey hook: HG_BUNDLE2=1 HG_HOOKNAME=prepushkey HG_HOOKTYPE=prepushkey HG_KEY=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_NAMESPACE=phases HG_NEW=0 HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_NODE_LAST=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_OLD=1 HG_PENDING=$TESTTMP/test HG_PHASES_MOVED=1 HG_SOURCE=serve HG_TXNID=TXN:$ID$ HG_URL=remote:http:$LOCALIP: (glob) | |
|
232 | % serve errors | |
|
233 | #endif | |
|
234 | ||
|
235 | $ hg --config extensions.strip= strip -r 1: | |
|
236 | saved backup bundle to $TESTTMP/test/.hg/strip-backup/ba677d0156c1-eea704d7-backup.hg | |
|
237 | ||
|
238 | Now do a variant of the above, except on a non-publishing repository | |
|
239 | ||
|
240 | $ cat >> .hg/hgrc <<EOF | |
|
241 | > [phases] | |
|
242 | > publish = false | |
|
243 | > [hooks] | |
|
244 | > prepushkey = sh -c "printenv.py prepushkey 1" | |
|
245 | > EOF | |
|
246 | ||
|
247 | #if bundle1 | |
|
153 | 248 | $ req |
|
154 | 249 | pushing to http://localhost:$HGPORT/ |
|
155 | 250 | searching for changes |
@@ -157,9 +252,60 b' expect phase change success' | |||
|
157 | 252 | remote: adding manifests |
|
158 | 253 | remote: adding file changes |
|
159 | 254 | remote: added 1 changesets with 1 changes to 1 files |
|
255 | remote: prepushkey hook: HG_HOOKNAME=prepushkey HG_HOOKTYPE=prepushkey HG_KEY=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_NAMESPACE=phases HG_NEW=0 HG_OLD=1 | |
|
256 | remote: pushkey-abort: prepushkey hook exited with status 1 | |
|
257 | updating ba677d0156c1 to public failed! | |
|
160 | 258 | % serve errors |
|
161 | $ hg rollback | |
|
162 | repository tip rolled back to revision 0 (undo serve) | |
|
259 | #endif | |
|
260 | ||
|
261 | #if bundle2 | |
|
262 | $ req | |
|
263 | pushing to http://localhost:$HGPORT/ | |
|
264 | searching for changes | |
|
265 | remote: adding changesets | |
|
266 | remote: adding manifests | |
|
267 | remote: adding file changes | |
|
268 | remote: added 1 changesets with 1 changes to 1 files | |
|
269 | remote: prepushkey hook: HG_BUNDLE2=1 HG_HOOKNAME=prepushkey HG_HOOKTYPE=prepushkey HG_KEY=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_NAMESPACE=phases HG_NEW=0 HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_NODE_LAST=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_OLD=1 HG_PENDING=$TESTTMP/test HG_PHASES_MOVED=1 HG_SOURCE=serve HG_TXNID=TXN:$ID$ HG_URL=remote:http:$LOCALIP: (glob) | |
|
270 | remote: pushkey-abort: prepushkey hook exited with status 1 | |
|
271 | remote: transaction abort! | |
|
272 | remote: rollback completed | |
|
273 | abort: updating ba677d0156c1 to public failed | |
|
274 | % serve errors | |
|
275 | [255] | |
|
276 | #endif | |
|
277 | ||
|
278 | Make phases updates work | |
|
279 | ||
|
280 | $ cat >> .hg/hgrc <<EOF | |
|
281 | > [hooks] | |
|
282 | > prepushkey = sh -c "printenv.py prepushkey 0" | |
|
283 | > EOF | |
|
284 | ||
|
285 | #if bundle1 | |
|
286 | $ req | |
|
287 | pushing to http://localhost:$HGPORT/ | |
|
288 | searching for changes | |
|
289 | no changes found | |
|
290 | remote: prepushkey hook: HG_HOOKNAME=prepushkey HG_HOOKTYPE=prepushkey HG_KEY=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_NAMESPACE=phases HG_NEW=0 HG_OLD=1 | |
|
291 | % serve errors | |
|
292 | [1] | |
|
293 | #endif | |
|
294 | ||
|
295 | #if bundle2 | |
|
296 | $ req | |
|
297 | pushing to http://localhost:$HGPORT/ | |
|
298 | searching for changes | |
|
299 | remote: adding changesets | |
|
300 | remote: adding manifests | |
|
301 | remote: adding file changes | |
|
302 | remote: added 1 changesets with 1 changes to 1 files | |
|
303 | remote: prepushkey hook: HG_BUNDLE2=1 HG_HOOKNAME=prepushkey HG_HOOKTYPE=prepushkey HG_KEY=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_NAMESPACE=phases HG_NEW=0 HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_NODE_LAST=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_OLD=1 HG_PENDING=$TESTTMP/test HG_PHASES_MOVED=1 HG_SOURCE=serve HG_TXNID=TXN:$ID$ HG_URL=remote:http:$LOCALIP: (glob) | |
|
304 | % serve errors | |
|
305 | #endif | |
|
306 | ||
|
307 | $ hg --config extensions.strip= strip -r 1: | |
|
308 | saved backup bundle to $TESTTMP/test/.hg/strip-backup/ba677d0156c1-eea704d7-backup.hg | |
|
163 | 309 | |
|
164 | 310 | expect authorization error: all users denied |
|
165 | 311 | |
@@ -183,6 +329,8 b' expect authorization error: some users d' | |||
|
183 | 329 | % serve errors |
|
184 | 330 | [255] |
|
185 | 331 | |
|
332 | #if bundle2 | |
|
333 | ||
|
186 | 334 | $ cat > .hg/hgrc <<EOF |
|
187 | 335 | > [web] |
|
188 | 336 | > push_ssl = false |
@@ -199,4 +347,6 b' expect authorization error: some users d' | |||
|
199 | 347 | remote: added 1 changesets with 1 changes to 1 files |
|
200 | 348 | % serve errors |
|
201 | 349 | |
|
350 | #endif | |
|
351 | ||
|
202 | 352 | $ cd .. |
|
1 | NO CONTENT: file was removed |
General Comments 0
You need to be logged in to leave comments.
Login now