##// END OF EJS Templates
test: use `printenv.py --line` in `test-http-bundle1.t`...
Boris Feld -
r41789:e06d91bc default
parent child Browse files
Show More
@@ -1,401 +1,408
1 1 #require serve
2 2
3 3 This test is a duplicate of 'test-http.t', feel free to factor out
4 4 parts that are not bundle1/bundle2 specific.
5 5
6 6 $ cat << EOF >> $HGRCPATH
7 7 > [devel]
8 8 > # This test is dedicated to interaction through old bundle
9 9 > legacy.exchange = bundle1
10 10 > EOF
11 11
12 12 $ hg init test
13 13 $ cd test
14 14 $ echo foo>foo
15 15 $ mkdir foo.d foo.d/bAr.hg.d foo.d/baR.d.hg
16 16 $ echo foo>foo.d/foo
17 17 $ echo bar>foo.d/bAr.hg.d/BaR
18 18 $ echo bar>foo.d/baR.d.hg/bAR
19 19 $ hg commit -A -m 1
20 20 adding foo
21 21 adding foo.d/bAr.hg.d/BaR
22 22 adding foo.d/baR.d.hg/bAR
23 23 adding foo.d/foo
24 24 $ hg serve -p $HGPORT -d --pid-file=../hg1.pid -E ../error.log
25 25 $ hg serve --config server.uncompressed=False -p $HGPORT1 -d --pid-file=../hg2.pid
26 26
27 27 Test server address cannot be reused
28 28
29 29 $ hg serve -p $HGPORT1 2>&1
30 30 abort: cannot start server at 'localhost:$HGPORT1': $EADDRINUSE$
31 31 [255]
32 32
33 33 $ cd ..
34 34 $ cat hg1.pid hg2.pid >> $DAEMON_PIDS
35 35
36 36 clone via stream
37 37
38 38 #if no-reposimplestore
39 39 $ hg clone --stream http://localhost:$HGPORT/ copy 2>&1
40 40 streaming all changes
41 41 6 files to transfer, 606 bytes of data
42 42 transferred * bytes in * seconds (*/sec) (glob)
43 43 searching for changes
44 44 no changes found
45 45 updating to branch default
46 46 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
47 47 $ hg verify -R copy
48 48 checking changesets
49 49 checking manifests
50 50 crosschecking files in changesets and manifests
51 51 checking files
52 52 checked 1 changesets with 4 changes to 4 files
53 53 #endif
54 54
55 55 try to clone via stream, should use pull instead
56 56
57 57 $ hg clone --stream http://localhost:$HGPORT1/ copy2
58 58 warning: stream clone requested but server has them disabled
59 59 requesting all changes
60 60 adding changesets
61 61 adding manifests
62 62 adding file changes
63 63 added 1 changesets with 4 changes to 4 files
64 64 new changesets 8b6053c928fe
65 65 updating to branch default
66 66 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
67 67
68 68 try to clone via stream but missing requirements, so should use pull instead
69 69
70 70 $ cat > $TESTTMP/removesupportedformat.py << EOF
71 71 > from mercurial import localrepo
72 72 > def extsetup(ui):
73 73 > localrepo.localrepository.supportedformats.remove(b'generaldelta')
74 74 > EOF
75 75
76 76 $ hg clone --config extensions.rsf=$TESTTMP/removesupportedformat.py --stream http://localhost:$HGPORT/ copy3
77 77 warning: stream clone requested but client is missing requirements: generaldelta
78 78 (see https://www.mercurial-scm.org/wiki/MissingRequirement for more information)
79 79 requesting all changes
80 80 adding changesets
81 81 adding manifests
82 82 adding file changes
83 83 added 1 changesets with 4 changes to 4 files
84 84 new changesets 8b6053c928fe
85 85 updating to branch default
86 86 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
87 87
88 88 clone via pull
89 89
90 90 $ hg clone http://localhost:$HGPORT1/ copy-pull
91 91 requesting all changes
92 92 adding changesets
93 93 adding manifests
94 94 adding file changes
95 95 added 1 changesets with 4 changes to 4 files
96 96 new changesets 8b6053c928fe
97 97 updating to branch default
98 98 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
99 99 $ hg verify -R copy-pull
100 100 checking changesets
101 101 checking manifests
102 102 crosschecking files in changesets and manifests
103 103 checking files
104 104 checked 1 changesets with 4 changes to 4 files
105 105 $ cd test
106 106 $ echo bar > bar
107 107 $ hg commit -A -d '1 0' -m 2
108 108 adding bar
109 109 $ cd ..
110 110
111 111 clone over http with --update
112 112
113 113 $ hg clone http://localhost:$HGPORT1/ updated --update 0
114 114 requesting all changes
115 115 adding changesets
116 116 adding manifests
117 117 adding file changes
118 118 added 2 changesets with 5 changes to 5 files
119 119 new changesets 8b6053c928fe:5fed3813f7f5
120 120 updating to branch default
121 121 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
122 122 $ hg log -r . -R updated
123 123 changeset: 0:8b6053c928fe
124 124 user: test
125 125 date: Thu Jan 01 00:00:00 1970 +0000
126 126 summary: 1
127 127
128 128 $ rm -rf updated
129 129
130 130 incoming via HTTP
131 131
132 132 $ hg clone http://localhost:$HGPORT1/ --rev 0 partial
133 133 adding changesets
134 134 adding manifests
135 135 adding file changes
136 136 added 1 changesets with 4 changes to 4 files
137 137 new changesets 8b6053c928fe
138 138 updating to branch default
139 139 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
140 140 $ cd partial
141 141 $ touch LOCAL
142 142 $ hg ci -qAm LOCAL
143 143 $ hg incoming http://localhost:$HGPORT1/ --template '{desc}\n'
144 144 comparing with http://localhost:$HGPORT1/
145 145 searching for changes
146 146 2
147 147 $ cd ..
148 148
149 149 pull
150 150
151 151 $ cd copy-pull
152 152 $ cat >> .hg/hgrc <<EOF
153 153 > [hooks]
154 > changegroup = sh -c "printenv.py changegroup"
154 > changegroup = sh -c "printenv.py --line changegroup"
155 155 > EOF
156 156 $ hg pull
157 157 pulling from http://localhost:$HGPORT1/
158 158 searching for changes
159 159 adding changesets
160 160 adding manifests
161 161 adding file changes
162 162 added 1 changesets with 1 changes to 1 files
163 163 new changesets 5fed3813f7f5
164 changegroup hook: HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=5fed3813f7f5e1824344fdc9cf8f63bb662c292d HG_NODE_LAST=5fed3813f7f5e1824344fdc9cf8f63bb662c292d HG_SOURCE=pull HG_TXNID=TXN:$ID$ HG_URL=http://localhost:$HGPORT1/
164 changegroup hook: HG_HOOKNAME=changegroup
165 HG_HOOKTYPE=changegroup
166 HG_NODE=5fed3813f7f5e1824344fdc9cf8f63bb662c292d
167 HG_NODE_LAST=5fed3813f7f5e1824344fdc9cf8f63bb662c292d
168 HG_SOURCE=pull
169 HG_TXNID=TXN:$ID$
170 HG_URL=http://localhost:$HGPORT1/
171
165 172 (run 'hg update' to get a working copy)
166 173 $ cd ..
167 174
168 175 clone from invalid URL
169 176
170 177 $ hg clone http://localhost:$HGPORT/bad
171 178 abort: HTTP Error 404: Not Found
172 179 [255]
173 180
174 181 test http authentication
175 182 + use the same server to test server side streaming preference
176 183
177 184 $ cd test
178 185
179 186 $ hg serve --config extensions.x=$TESTDIR/httpserverauth.py -p $HGPORT2 -d \
180 187 > --pid-file=pid --config server.preferuncompressed=True \
181 188 > --config web.push_ssl=False --config web.allow_push=* -A ../access.log
182 189 $ cat pid >> $DAEMON_PIDS
183 190
184 191 $ cat << EOF > get_pass.py
185 192 > import getpass
186 193 > def newgetpass(arg):
187 194 > return "pass"
188 195 > getpass.getpass = newgetpass
189 196 > EOF
190 197
191 198 $ hg id http://localhost:$HGPORT2/
192 199 abort: http authorization required for http://localhost:$HGPORT2/
193 200 [255]
194 201 $ hg id http://localhost:$HGPORT2/
195 202 abort: http authorization required for http://localhost:$HGPORT2/
196 203 [255]
197 204 $ hg id --config ui.interactive=true --config extensions.getpass=get_pass.py http://user@localhost:$HGPORT2/
198 205 http authorization required for http://localhost:$HGPORT2/
199 206 realm: mercurial
200 207 user: user
201 208 password: 5fed3813f7f5
202 209 $ hg id http://user:pass@localhost:$HGPORT2/
203 210 5fed3813f7f5
204 211 $ echo '[auth]' >> .hg/hgrc
205 212 $ echo 'l.schemes=http' >> .hg/hgrc
206 213 $ echo 'l.prefix=lo' >> .hg/hgrc
207 214 $ echo 'l.username=user' >> .hg/hgrc
208 215 $ echo 'l.password=pass' >> .hg/hgrc
209 216 $ hg id http://localhost:$HGPORT2/
210 217 5fed3813f7f5
211 218 $ hg id http://localhost:$HGPORT2/
212 219 5fed3813f7f5
213 220 $ hg id http://user@localhost:$HGPORT2/
214 221 5fed3813f7f5
215 222
216 223 #if no-reposimplestore
217 224 $ hg clone http://user:pass@localhost:$HGPORT2/ dest 2>&1
218 225 streaming all changes
219 226 7 files to transfer, 916 bytes of data
220 227 transferred * bytes in * seconds (*/sec) (glob)
221 228 searching for changes
222 229 no changes found
223 230 updating to branch default
224 231 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
225 232 #endif
226 233
227 234 --pull should override server's preferuncompressed
228 235
229 236 $ hg clone --pull http://user:pass@localhost:$HGPORT2/ dest-pull 2>&1
230 237 requesting all changes
231 238 adding changesets
232 239 adding manifests
233 240 adding file changes
234 241 added 2 changesets with 5 changes to 5 files
235 242 new changesets 8b6053c928fe:5fed3813f7f5
236 243 updating to branch default
237 244 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
238 245
239 246 $ hg id http://user2@localhost:$HGPORT2/
240 247 abort: http authorization required for http://localhost:$HGPORT2/
241 248 [255]
242 249 $ hg id http://user:pass2@localhost:$HGPORT2/
243 250 abort: HTTP Error 403: no
244 251 [255]
245 252
246 253 $ hg -R dest-pull tag -r tip top
247 254 $ hg -R dest-pull push http://user:pass@localhost:$HGPORT2/
248 255 pushing to http://user:***@localhost:$HGPORT2/
249 256 searching for changes
250 257 remote: adding changesets
251 258 remote: adding manifests
252 259 remote: adding file changes
253 260 remote: added 1 changesets with 1 changes to 1 files
254 261 $ hg rollback -q
255 262
256 263 $ sed 's/.*] "/"/' < ../access.log
257 264 "GET /?cmd=capabilities HTTP/1.1" 401 -
258 265 "GET /?cmd=capabilities HTTP/1.1" 401 -
259 266 "GET /?cmd=capabilities HTTP/1.1" 401 -
260 267 "GET /?cmd=capabilities HTTP/1.1" 200 -
261 268 "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
262 269 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
263 270 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
264 271 "GET /?cmd=capabilities HTTP/1.1" 401 -
265 272 "GET /?cmd=capabilities HTTP/1.1" 200 -
266 273 "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
267 274 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
268 275 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
269 276 "GET /?cmd=capabilities HTTP/1.1" 401 -
270 277 "GET /?cmd=capabilities HTTP/1.1" 200 -
271 278 "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
272 279 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
273 280 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
274 281 "GET /?cmd=capabilities HTTP/1.1" 401 -
275 282 "GET /?cmd=capabilities HTTP/1.1" 200 -
276 283 "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
277 284 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
278 285 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
279 286 "GET /?cmd=capabilities HTTP/1.1" 401 -
280 287 "GET /?cmd=capabilities HTTP/1.1" 200 -
281 288 "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
282 289 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
283 290 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
284 291 "GET /?cmd=capabilities HTTP/1.1" 401 - (no-reposimplestore !)
285 292 "GET /?cmd=capabilities HTTP/1.1" 200 - (no-reposimplestore !)
286 293 "GET /?cmd=branchmap HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (no-reposimplestore !)
287 294 "GET /?cmd=stream_out HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (no-reposimplestore !)
288 295 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (no-reposimplestore !)
289 296 "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D5fed3813f7f5e1824344fdc9cf8f63bb662c292d x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (no-reposimplestore !)
290 297 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (no-reposimplestore !)
291 298 "GET /?cmd=capabilities HTTP/1.1" 401 - (no-reposimplestore !)
292 299 "GET /?cmd=capabilities HTTP/1.1" 200 - (no-reposimplestore !)
293 300 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (no-reposimplestore !)
294 301 "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
295 302 "GET /?cmd=getbundle HTTP/1.1" 200 - x-hgarg-1:common=0000000000000000000000000000000000000000&heads=5fed3813f7f5e1824344fdc9cf8f63bb662c292d x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
296 303 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
297 304 "GET /?cmd=capabilities HTTP/1.1" 401 -
298 305 "GET /?cmd=capabilities HTTP/1.1" 401 -
299 306 "GET /?cmd=capabilities HTTP/1.1" 403 -
300 307 "GET /?cmd=capabilities HTTP/1.1" 401 -
301 308 "GET /?cmd=capabilities HTTP/1.1" 200 -
302 309 "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D7f4e523d01f2cc3765ac8934da3d14db775ff872 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
303 310 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
304 311 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
305 312 "GET /?cmd=branchmap HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
306 313 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
307 314 "POST /?cmd=unbundle HTTP/1.1" 200 - x-hgarg-1:heads=686173686564+5eb5abfefeea63c80dd7553bcc3783f37e0c5524* (glob)
308 315 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
309 316
310 317 $ cd ..
311 318
312 319 clone of serve with repo in root and unserved subrepo (issue2970)
313 320
314 321 $ hg --cwd test init sub
315 322 $ echo empty > test/sub/empty
316 323 $ hg --cwd test/sub add empty
317 324 $ hg --cwd test/sub commit -qm 'add empty'
318 325 $ hg --cwd test/sub tag -r 0 something
319 326 $ echo sub = sub > test/.hgsub
320 327 $ hg --cwd test add .hgsub
321 328 $ hg --cwd test commit -qm 'add subrepo'
322 329 $ hg clone http://localhost:$HGPORT noslash-clone
323 330 requesting all changes
324 331 adding changesets
325 332 adding manifests
326 333 adding file changes
327 334 added 3 changesets with 7 changes to 7 files
328 335 new changesets 8b6053c928fe:56f9bc90cce6
329 336 updating to branch default
330 337 cloning subrepo sub from http://localhost:$HGPORT/sub
331 338 abort: HTTP Error 404: Not Found
332 339 [255]
333 340 $ hg clone http://localhost:$HGPORT/ slash-clone
334 341 requesting all changes
335 342 adding changesets
336 343 adding manifests
337 344 adding file changes
338 345 added 3 changesets with 7 changes to 7 files
339 346 new changesets 8b6053c928fe:56f9bc90cce6
340 347 updating to branch default
341 348 cloning subrepo sub from http://localhost:$HGPORT/sub
342 349 abort: HTTP Error 404: Not Found
343 350 [255]
344 351
345 352 check error log
346 353
347 354 $ cat error.log
348 355
349 356 Check error reporting while pulling/cloning
350 357
351 358 $ $RUNTESTDIR/killdaemons.py
352 359 $ hg serve -R test -p $HGPORT -d --pid-file=hg3.pid -E error.log --config extensions.crash=${TESTDIR}/crashgetbundler.py
353 360 $ cat hg3.pid >> $DAEMON_PIDS
354 361 $ hg clone http://localhost:$HGPORT/ abort-clone
355 362 requesting all changes
356 363 abort: remote error:
357 364 this is an exercise
358 365 [255]
359 366 $ cat error.log
360 367
361 368 disable pull-based clones
362 369
363 370 $ hg serve -R test -p $HGPORT1 -d --pid-file=hg4.pid -E error.log --config server.disablefullbundle=True
364 371 $ cat hg4.pid >> $DAEMON_PIDS
365 372 $ hg clone http://localhost:$HGPORT1/ disable-pull-clone
366 373 requesting all changes
367 374 abort: remote error:
368 375 server has pull-based clones disabled
369 376 [255]
370 377
371 378 #if no-reposimplestore
372 379 ... but keep stream clones working
373 380
374 381 $ hg clone --stream --noupdate http://localhost:$HGPORT1/ test-stream-clone
375 382 streaming all changes
376 383 * files to transfer, * of data (glob)
377 384 transferred * in * seconds (* KB/sec) (glob)
378 385 searching for changes
379 386 no changes found
380 387 #endif
381 388
382 389 ... and also keep partial clones and pulls working
383 390 $ hg clone http://localhost:$HGPORT1 --rev 0 test-partial-clone
384 391 adding changesets
385 392 adding manifests
386 393 adding file changes
387 394 added 1 changesets with 4 changes to 4 files
388 395 new changesets 8b6053c928fe
389 396 updating to branch default
390 397 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
391 398 $ hg pull -R test-partial-clone
392 399 pulling from http://localhost:$HGPORT1/
393 400 searching for changes
394 401 adding changesets
395 402 adding manifests
396 403 adding file changes
397 404 added 2 changesets with 3 changes to 3 files
398 405 new changesets 5fed3813f7f5:56f9bc90cce6
399 406 (run 'hg update' to get a working copy)
400 407
401 408 $ cat error.log
General Comments 0
You need to be logged in to leave comments. Login now