##// END OF EJS Templates
tests: monkeypatch `util.get_password()` to avoid deadlocks on Windows...
Matt Harbison -
r48103:5ac0f2a8 stable
parent child Browse files
Show More
@@ -1,412 +1,412 b''
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 (no-zstd !)
42 42 6 files to transfer, 608 bytes of data (zstd !)
43 43 transferred * bytes in * seconds (*/sec) (glob)
44 44 searching for changes
45 45 no changes found
46 46 updating to branch default
47 47 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
48 48 $ hg verify -R copy
49 49 checking changesets
50 50 checking manifests
51 51 crosschecking files in changesets and manifests
52 52 checking files
53 53 checked 1 changesets with 4 changes to 4 files
54 54 #endif
55 55
56 56 try to clone via stream, should use pull instead
57 57
58 58 $ hg clone --stream http://localhost:$HGPORT1/ copy2
59 59 warning: stream clone requested but server has them disabled
60 60 requesting all changes
61 61 adding changesets
62 62 adding manifests
63 63 adding file changes
64 64 added 1 changesets with 4 changes to 4 files
65 65 new changesets 8b6053c928fe
66 66 updating to branch default
67 67 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
68 68
69 69 try to clone via stream but missing requirements, so should use pull instead
70 70
71 71 $ cat > $TESTTMP/removesupportedformat.py << EOF
72 72 > from mercurial import localrepo
73 73 > def extsetup(ui):
74 74 > localrepo.localrepository.supportedformats.remove(b'generaldelta')
75 75 > EOF
76 76
77 77 $ hg clone --config extensions.rsf=$TESTTMP/removesupportedformat.py --stream http://localhost:$HGPORT/ copy3
78 78 warning: stream clone requested but client is missing requirements: generaldelta
79 79 (see https://www.mercurial-scm.org/wiki/MissingRequirement for more information)
80 80 requesting all changes
81 81 adding changesets
82 82 adding manifests
83 83 adding file changes
84 84 added 1 changesets with 4 changes to 4 files
85 85 new changesets 8b6053c928fe
86 86 updating to branch default
87 87 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
88 88
89 89 clone via pull
90 90
91 91 $ hg clone http://localhost:$HGPORT1/ copy-pull
92 92 requesting all changes
93 93 adding changesets
94 94 adding manifests
95 95 adding file changes
96 96 added 1 changesets with 4 changes to 4 files
97 97 new changesets 8b6053c928fe
98 98 updating to branch default
99 99 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
100 100 $ hg verify -R copy-pull
101 101 checking changesets
102 102 checking manifests
103 103 crosschecking files in changesets and manifests
104 104 checking files
105 105 checked 1 changesets with 4 changes to 4 files
106 106 $ cd test
107 107 $ echo bar > bar
108 108 $ hg commit -A -d '1 0' -m 2
109 109 adding bar
110 110 $ cd ..
111 111
112 112 clone over http with --update
113 113
114 114 $ hg clone http://localhost:$HGPORT1/ updated --update 0
115 115 requesting all changes
116 116 adding changesets
117 117 adding manifests
118 118 adding file changes
119 119 added 2 changesets with 5 changes to 5 files
120 120 new changesets 8b6053c928fe:5fed3813f7f5
121 121 updating to branch default
122 122 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
123 123 $ hg log -r . -R updated
124 124 changeset: 0:8b6053c928fe
125 125 user: test
126 126 date: Thu Jan 01 00:00:00 1970 +0000
127 127 summary: 1
128 128
129 129 $ rm -rf updated
130 130
131 131 incoming via HTTP
132 132
133 133 $ hg clone http://localhost:$HGPORT1/ --rev 0 partial
134 134 adding changesets
135 135 adding manifests
136 136 adding file changes
137 137 added 1 changesets with 4 changes to 4 files
138 138 new changesets 8b6053c928fe
139 139 updating to branch default
140 140 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
141 141 $ cd partial
142 142 $ touch LOCAL
143 143 $ hg ci -qAm LOCAL
144 144 $ hg incoming http://localhost:$HGPORT1/ --template '{desc}\n'
145 145 comparing with http://localhost:$HGPORT1/
146 146 searching for changes
147 147 2
148 148 $ cd ..
149 149
150 150 pull
151 151
152 152 $ cd copy-pull
153 153 $ cat >> .hg/hgrc <<EOF
154 154 > [hooks]
155 155 > changegroup = sh -c "printenv.py --line changegroup"
156 156 > EOF
157 157 $ hg pull
158 158 pulling from http://localhost:$HGPORT1/
159 159 searching for changes
160 160 adding changesets
161 161 adding manifests
162 162 adding file changes
163 163 added 1 changesets with 1 changes to 1 files
164 164 new changesets 5fed3813f7f5
165 165 changegroup hook: HG_HOOKNAME=changegroup
166 166 HG_HOOKTYPE=changegroup
167 167 HG_NODE=5fed3813f7f5e1824344fdc9cf8f63bb662c292d
168 168 HG_NODE_LAST=5fed3813f7f5e1824344fdc9cf8f63bb662c292d
169 169 HG_SOURCE=pull
170 170 HG_TXNID=TXN:$ID$
171 171 HG_TXNNAME=pull
172 172 http://localhost:$HGPORT1/
173 173 HG_URL=http://localhost:$HGPORT1/
174 174
175 175 (run 'hg update' to get a working copy)
176 176 $ cd ..
177 177
178 178 clone from invalid URL
179 179
180 180 $ hg clone http://localhost:$HGPORT/bad
181 181 abort: HTTP Error 404: Not Found
182 182 [100]
183 183
184 184 test http authentication
185 185 + use the same server to test server side streaming preference
186 186
187 187 $ cd test
188 188
189 189 $ hg serve --config extensions.x=$TESTDIR/httpserverauth.py -p $HGPORT2 -d \
190 190 > --pid-file=pid --config server.preferuncompressed=True \
191 191 > --config web.push_ssl=False --config web.allow_push=* -A ../access.log
192 192 $ cat pid >> $DAEMON_PIDS
193 193
194 194 $ cat << EOF > get_pass.py
195 > import getpass
196 > def newgetpass(arg):
195 > from mercurial import util
196 > def newgetpass():
197 197 > return "pass"
198 > getpass.getpass = newgetpass
198 > util.get_password = newgetpass
199 199 > EOF
200 200
201 201 $ hg id http://localhost:$HGPORT2/
202 202 abort: http authorization required for http://localhost:$HGPORT2/
203 203 [255]
204 204 $ hg id http://localhost:$HGPORT2/
205 205 abort: http authorization required for http://localhost:$HGPORT2/
206 206 [255]
207 207 $ hg id --config ui.interactive=true --config extensions.getpass=get_pass.py http://user@localhost:$HGPORT2/
208 208 http authorization required for http://localhost:$HGPORT2/
209 209 realm: mercurial
210 210 user: user
211 211 password: 5fed3813f7f5
212 212 $ hg id http://user:pass@localhost:$HGPORT2/
213 213 5fed3813f7f5
214 214 $ echo '[auth]' >> .hg/hgrc
215 215 $ echo 'l.schemes=http' >> .hg/hgrc
216 216 $ echo 'l.prefix=lo' >> .hg/hgrc
217 217 $ echo 'l.username=user' >> .hg/hgrc
218 218 $ echo 'l.password=pass' >> .hg/hgrc
219 219 $ hg id http://localhost:$HGPORT2/
220 220 5fed3813f7f5
221 221 $ hg id http://localhost:$HGPORT2/
222 222 5fed3813f7f5
223 223 $ hg id http://user@localhost:$HGPORT2/
224 224 5fed3813f7f5
225 225
226 226 #if no-reposimplestore
227 227 $ hg clone http://user:pass@localhost:$HGPORT2/ dest 2>&1
228 228 streaming all changes
229 229 7 files to transfer, 916 bytes of data (no-zstd !)
230 230 7 files to transfer, 919 bytes of data (zstd !)
231 231 transferred * bytes in * seconds (*/sec) (glob)
232 232 searching for changes
233 233 no changes found
234 234 updating to branch default
235 235 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
236 236 #endif
237 237
238 238 --pull should override server's preferuncompressed
239 239
240 240 $ hg clone --pull http://user:pass@localhost:$HGPORT2/ dest-pull 2>&1
241 241 requesting all changes
242 242 adding changesets
243 243 adding manifests
244 244 adding file changes
245 245 added 2 changesets with 5 changes to 5 files
246 246 new changesets 8b6053c928fe:5fed3813f7f5
247 247 updating to branch default
248 248 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
249 249
250 250 $ hg id http://user2@localhost:$HGPORT2/
251 251 abort: http authorization required for http://localhost:$HGPORT2/
252 252 [255]
253 253 $ hg id http://user:pass2@localhost:$HGPORT2/
254 254 abort: HTTP Error 403: no
255 255 [100]
256 256
257 257 $ hg -R dest-pull tag -r tip top
258 258 $ hg -R dest-pull push http://user:pass@localhost:$HGPORT2/
259 259 pushing to http://user:***@localhost:$HGPORT2/
260 260 searching for changes
261 261 remote: adding changesets
262 262 remote: adding manifests
263 263 remote: adding file changes
264 264 remote: added 1 changesets with 1 changes to 1 files
265 265 $ hg rollback -q
266 266
267 267 $ sed 's/.*] "/"/' < ../access.log
268 268 "GET /?cmd=capabilities HTTP/1.1" 401 -
269 269 "GET /?cmd=capabilities HTTP/1.1" 401 -
270 270 "GET /?cmd=capabilities HTTP/1.1" 401 -
271 271 "GET /?cmd=capabilities HTTP/1.1" 200 -
272 272 "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
273 273 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
274 274 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
275 275 "GET /?cmd=capabilities HTTP/1.1" 401 -
276 276 "GET /?cmd=capabilities HTTP/1.1" 200 -
277 277 "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
278 278 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
279 279 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
280 280 "GET /?cmd=capabilities HTTP/1.1" 401 -
281 281 "GET /?cmd=capabilities HTTP/1.1" 200 -
282 282 "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
283 283 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
284 284 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
285 285 "GET /?cmd=capabilities HTTP/1.1" 401 -
286 286 "GET /?cmd=capabilities HTTP/1.1" 200 -
287 287 "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
288 288 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
289 289 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
290 290 "GET /?cmd=capabilities HTTP/1.1" 401 -
291 291 "GET /?cmd=capabilities HTTP/1.1" 200 -
292 292 "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
293 293 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
294 294 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
295 295 "GET /?cmd=capabilities HTTP/1.1" 401 - (no-reposimplestore !)
296 296 "GET /?cmd=capabilities HTTP/1.1" 200 - (no-reposimplestore !)
297 297 "GET /?cmd=branchmap HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (no-reposimplestore !)
298 298 "GET /?cmd=stream_out HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (no-reposimplestore !)
299 299 "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 !)
300 300 "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 !)
301 301 "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 !)
302 302 "GET /?cmd=capabilities HTTP/1.1" 401 - (no-reposimplestore !)
303 303 "GET /?cmd=capabilities HTTP/1.1" 200 - (no-reposimplestore !)
304 304 "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 !)
305 305 "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
306 306 "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
307 307 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
308 308 "GET /?cmd=capabilities HTTP/1.1" 401 -
309 309 "GET /?cmd=capabilities HTTP/1.1" 401 -
310 310 "GET /?cmd=capabilities HTTP/1.1" 403 -
311 311 "GET /?cmd=capabilities HTTP/1.1" 401 -
312 312 "GET /?cmd=capabilities HTTP/1.1" 200 -
313 313 "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
314 314 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
315 315 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
316 316 "GET /?cmd=branchmap HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
317 317 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
318 318 "POST /?cmd=unbundle HTTP/1.1" 200 - x-hgarg-1:heads=686173686564+5eb5abfefeea63c80dd7553bcc3783f37e0c5524* (glob)
319 319 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
320 320
321 321 $ cd ..
322 322
323 323 clone of serve with repo in root and unserved subrepo (issue2970)
324 324
325 325 $ hg --cwd test init sub
326 326 $ echo empty > test/sub/empty
327 327 $ hg --cwd test/sub add empty
328 328 $ hg --cwd test/sub commit -qm 'add empty'
329 329 $ hg --cwd test/sub tag -r 0 something
330 330 $ echo sub = sub > test/.hgsub
331 331 $ hg --cwd test add .hgsub
332 332 $ hg --cwd test commit -qm 'add subrepo'
333 333 $ hg clone http://localhost:$HGPORT noslash-clone
334 334 requesting all changes
335 335 adding changesets
336 336 adding manifests
337 337 adding file changes
338 338 added 3 changesets with 7 changes to 7 files
339 339 new changesets 8b6053c928fe:56f9bc90cce6
340 340 updating to branch default
341 341 cloning subrepo sub from http://localhost:$HGPORT/sub
342 342 abort: HTTP Error 404: Not Found
343 343 [100]
344 344 $ hg clone http://localhost:$HGPORT/ slash-clone
345 345 requesting all changes
346 346 adding changesets
347 347 adding manifests
348 348 adding file changes
349 349 added 3 changesets with 7 changes to 7 files
350 350 new changesets 8b6053c928fe:56f9bc90cce6
351 351 updating to branch default
352 352 cloning subrepo sub from http://localhost:$HGPORT/sub
353 353 abort: HTTP Error 404: Not Found
354 354 [100]
355 355
356 356 check error log
357 357
358 358 $ cat error.log
359 359
360 360 Check error reporting while pulling/cloning
361 361
362 362 $ $RUNTESTDIR/killdaemons.py
363 363 $ hg serve -R test -p $HGPORT -d --pid-file=hg3.pid -E error.log --config extensions.crash=${TESTDIR}/crashgetbundler.py
364 364 $ cat hg3.pid >> $DAEMON_PIDS
365 365 $ hg clone http://localhost:$HGPORT/ abort-clone
366 366 requesting all changes
367 367 abort: remote error:
368 368 this is an exercise
369 369 [100]
370 370 $ cat error.log
371 371
372 372 disable pull-based clones
373 373
374 374 $ hg serve -R test -p $HGPORT1 -d --pid-file=hg4.pid -E error.log --config server.disablefullbundle=True
375 375 $ cat hg4.pid >> $DAEMON_PIDS
376 376 $ hg clone http://localhost:$HGPORT1/ disable-pull-clone
377 377 requesting all changes
378 378 abort: remote error:
379 379 server has pull-based clones disabled
380 380 [100]
381 381
382 382 #if no-reposimplestore
383 383 ... but keep stream clones working
384 384
385 385 $ hg clone --stream --noupdate http://localhost:$HGPORT1/ test-stream-clone
386 386 streaming all changes
387 387 * files to transfer, * of data (glob)
388 388 transferred * in * seconds (* KB/sec) (glob)
389 389 searching for changes
390 390 no changes found
391 391 #endif
392 392
393 393 ... and also keep partial clones and pulls working
394 394 $ hg clone http://localhost:$HGPORT1 --rev 0 test-partial-clone
395 395 adding changesets
396 396 adding manifests
397 397 adding file changes
398 398 added 1 changesets with 4 changes to 4 files
399 399 new changesets 8b6053c928fe
400 400 updating to branch default
401 401 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
402 402 $ hg pull -R test-partial-clone
403 403 pulling from http://localhost:$HGPORT1/
404 404 searching for changes
405 405 adding changesets
406 406 adding manifests
407 407 adding file changes
408 408 added 2 changesets with 3 changes to 3 files
409 409 new changesets 5fed3813f7f5:56f9bc90cce6
410 410 (run 'hg update' to get a working copy)
411 411
412 412 $ cat error.log
@@ -1,617 +1,617 b''
1 1 #require serve
2 2
3 3 $ hg init test
4 4 $ cd test
5 5 $ echo foo>foo
6 6 $ mkdir foo.d foo.d/bAr.hg.d foo.d/baR.d.hg
7 7 $ echo foo>foo.d/foo
8 8 $ echo bar>foo.d/bAr.hg.d/BaR
9 9 $ echo bar>foo.d/baR.d.hg/bAR
10 10 $ hg commit -A -m 1
11 11 adding foo
12 12 adding foo.d/bAr.hg.d/BaR
13 13 adding foo.d/baR.d.hg/bAR
14 14 adding foo.d/foo
15 15 $ hg serve -p $HGPORT -d --pid-file=../hg1.pid -E ../error.log
16 16 $ hg serve --config server.uncompressed=False -p $HGPORT1 -d --pid-file=../hg2.pid
17 17
18 18 Test server address cannot be reused
19 19
20 20 $ hg serve -p $HGPORT1 2>&1
21 21 abort: cannot start server at 'localhost:$HGPORT1': $EADDRINUSE$
22 22 [255]
23 23
24 24 $ cd ..
25 25 $ cat hg1.pid hg2.pid >> $DAEMON_PIDS
26 26
27 27 clone via stream
28 28
29 29 #if no-reposimplestore
30 30 $ hg clone --stream http://localhost:$HGPORT/ copy 2>&1
31 31 streaming all changes
32 32 9 files to transfer, 715 bytes of data (no-zstd !)
33 33 9 files to transfer, 717 bytes of data (zstd !)
34 34 transferred * bytes in * seconds (*/sec) (glob)
35 35 updating to branch default
36 36 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
37 37 $ hg verify -R copy
38 38 checking changesets
39 39 checking manifests
40 40 crosschecking files in changesets and manifests
41 41 checking files
42 42 checked 1 changesets with 4 changes to 4 files
43 43 #endif
44 44
45 45 try to clone via stream, should use pull instead
46 46
47 47 $ hg clone --stream http://localhost:$HGPORT1/ copy2
48 48 warning: stream clone requested but server has them disabled
49 49 requesting all changes
50 50 adding changesets
51 51 adding manifests
52 52 adding file changes
53 53 added 1 changesets with 4 changes to 4 files
54 54 new changesets 8b6053c928fe
55 55 updating to branch default
56 56 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
57 57
58 58 try to clone via stream but missing requirements, so should use pull instead
59 59
60 60 $ cat > $TESTTMP/removesupportedformat.py << EOF
61 61 > from mercurial import localrepo
62 62 > def extsetup(ui):
63 63 > localrepo.localrepository.supportedformats.remove(b'generaldelta')
64 64 > EOF
65 65
66 66 $ hg clone --config extensions.rsf=$TESTTMP/removesupportedformat.py --stream http://localhost:$HGPORT/ copy3
67 67 warning: stream clone requested but client is missing requirements: generaldelta
68 68 (see https://www.mercurial-scm.org/wiki/MissingRequirement for more information)
69 69 requesting all changes
70 70 adding changesets
71 71 adding manifests
72 72 adding file changes
73 73 added 1 changesets with 4 changes to 4 files
74 74 new changesets 8b6053c928fe
75 75 updating to branch default
76 76 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
77 77
78 78 clone via pull
79 79
80 80 $ hg clone http://localhost:$HGPORT1/ copy-pull
81 81 requesting all changes
82 82 adding changesets
83 83 adding manifests
84 84 adding file changes
85 85 added 1 changesets with 4 changes to 4 files
86 86 new changesets 8b6053c928fe
87 87 updating to branch default
88 88 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
89 89 $ hg verify -R copy-pull
90 90 checking changesets
91 91 checking manifests
92 92 crosschecking files in changesets and manifests
93 93 checking files
94 94 checked 1 changesets with 4 changes to 4 files
95 95 $ cd test
96 96 $ echo bar > bar
97 97 $ hg commit -A -d '1 0' -m 2
98 98 adding bar
99 99 $ cd ..
100 100
101 101 clone over http with --update
102 102
103 103 $ hg clone http://localhost:$HGPORT1/ updated --update 0
104 104 requesting all changes
105 105 adding changesets
106 106 adding manifests
107 107 adding file changes
108 108 added 2 changesets with 5 changes to 5 files
109 109 new changesets 8b6053c928fe:5fed3813f7f5
110 110 updating to branch default
111 111 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
112 112 $ hg log -r . -R updated
113 113 changeset: 0:8b6053c928fe
114 114 user: test
115 115 date: Thu Jan 01 00:00:00 1970 +0000
116 116 summary: 1
117 117
118 118 $ rm -rf updated
119 119
120 120 incoming via HTTP
121 121
122 122 $ hg clone http://localhost:$HGPORT1/ --rev 0 partial
123 123 adding changesets
124 124 adding manifests
125 125 adding file changes
126 126 added 1 changesets with 4 changes to 4 files
127 127 new changesets 8b6053c928fe
128 128 updating to branch default
129 129 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
130 130 $ cd partial
131 131 $ touch LOCAL
132 132 $ hg ci -qAm LOCAL
133 133 $ hg incoming http://localhost:$HGPORT1/ --template '{desc}\n'
134 134 comparing with http://localhost:$HGPORT1/
135 135 searching for changes
136 136 2
137 137 $ cd ..
138 138
139 139 pull
140 140
141 141 $ cd copy-pull
142 142 $ cat >> .hg/hgrc <<EOF
143 143 > [hooks]
144 144 > changegroup = sh -c "printenv.py --line changegroup"
145 145 > EOF
146 146 $ hg pull
147 147 pulling from http://localhost:$HGPORT1/
148 148 searching for changes
149 149 adding changesets
150 150 adding manifests
151 151 adding file changes
152 152 added 1 changesets with 1 changes to 1 files
153 153 new changesets 5fed3813f7f5
154 154 changegroup hook: HG_HOOKNAME=changegroup
155 155 HG_HOOKTYPE=changegroup
156 156 HG_NODE=5fed3813f7f5e1824344fdc9cf8f63bb662c292d
157 157 HG_NODE_LAST=5fed3813f7f5e1824344fdc9cf8f63bb662c292d
158 158 HG_SOURCE=pull
159 159 HG_TXNID=TXN:$ID$
160 160 HG_TXNNAME=pull
161 161 http://localhost:$HGPORT1/
162 162 HG_URL=http://localhost:$HGPORT1/
163 163
164 164 (run 'hg update' to get a working copy)
165 165 $ cd ..
166 166
167 167 clone from invalid URL
168 168
169 169 $ hg clone http://localhost:$HGPORT/bad
170 170 abort: HTTP Error 404: Not Found
171 171 [100]
172 172
173 173 test http authentication
174 174 + use the same server to test server side streaming preference
175 175
176 176 $ cd test
177 177
178 178 $ hg serve --config extensions.x=$TESTDIR/httpserverauth.py -p $HGPORT2 -d \
179 179 > --pid-file=pid --config server.preferuncompressed=True -E ../errors2.log \
180 180 > --config web.push_ssl=False --config web.allow_push=* -A ../access.log
181 181 $ cat pid >> $DAEMON_PIDS
182 182
183 183 $ cat << EOF > get_pass.py
184 > import getpass
185 > def newgetpass(arg):
184 > from mercurial import util
185 > def newgetpass():
186 186 > return "pass"
187 > getpass.getpass = newgetpass
187 > util.get_password = newgetpass
188 188 > EOF
189 189
190 190 $ hg id http://localhost:$HGPORT2/
191 191 abort: http authorization required for http://localhost:$HGPORT2/
192 192 [255]
193 193 $ hg id http://localhost:$HGPORT2/
194 194 abort: http authorization required for http://localhost:$HGPORT2/
195 195 [255]
196 196 $ hg id --config ui.interactive=true --debug http://localhost:$HGPORT2/
197 197 using http://localhost:$HGPORT2/
198 198 sending capabilities command
199 199 http authorization required for http://localhost:$HGPORT2/
200 200 realm: mercurial
201 201 user: abort: response expected
202 202 [255]
203 203 $ cat <<'EOF' | hg id --config ui.interactive=true --config ui.nontty=true --debug http://localhost:$HGPORT2/
204 204 >
205 205 > EOF
206 206 using http://localhost:$HGPORT2/
207 207 sending capabilities command
208 208 http authorization required for http://localhost:$HGPORT2/
209 209 realm: mercurial
210 210 user:
211 211 password: abort: response expected
212 212 [255]
213 213 $ cat <<'EOF' | hg id --config ui.interactive=true --config ui.nontty=true --debug http://localhost:$HGPORT2/
214 214 >
215 215 >
216 216 > EOF
217 217 using http://localhost:$HGPORT2/
218 218 sending capabilities command
219 219 http authorization required for http://localhost:$HGPORT2/
220 220 realm: mercurial
221 221 user:
222 222 password: abort: authorization failed
223 223 [255]
224 224 $ hg id --config ui.interactive=true --config extensions.getpass=get_pass.py http://user@localhost:$HGPORT2/
225 225 http authorization required for http://localhost:$HGPORT2/
226 226 realm: mercurial
227 227 user: user
228 228 password: 5fed3813f7f5
229 229 $ hg id http://user:pass@localhost:$HGPORT2/
230 230 5fed3813f7f5
231 231 $ echo '[auth]' >> .hg/hgrc
232 232 $ echo 'l.schemes=http' >> .hg/hgrc
233 233 $ echo 'l.prefix=lo' >> .hg/hgrc
234 234 $ echo 'l.username=user' >> .hg/hgrc
235 235 $ echo 'l.password=pass' >> .hg/hgrc
236 236 $ hg id http://localhost:$HGPORT2/
237 237 5fed3813f7f5
238 238 $ hg id http://localhost:$HGPORT2/
239 239 5fed3813f7f5
240 240 $ hg id http://user@localhost:$HGPORT2/
241 241 5fed3813f7f5
242 242
243 243 $ cat > use_digests.py << EOF
244 244 > from mercurial import (
245 245 > exthelper,
246 246 > url,
247 247 > )
248 248 >
249 249 > eh = exthelper.exthelper()
250 250 > uisetup = eh.finaluisetup
251 251 >
252 252 > @eh.wrapfunction(url, 'opener')
253 253 > def urlopener(orig, *args, **kwargs):
254 254 > opener = orig(*args, **kwargs)
255 255 > opener.addheaders.append((r'X-HgTest-AuthType', r'Digest'))
256 256 > return opener
257 257 > EOF
258 258
259 259 $ hg id http://localhost:$HGPORT2/ --config extensions.x=use_digests.py
260 260 5fed3813f7f5
261 261
262 262 #if no-reposimplestore
263 263 $ hg clone http://user:pass@localhost:$HGPORT2/ dest 2>&1
264 264 streaming all changes
265 265 10 files to transfer, 1.01 KB of data
266 266 transferred * KB in * seconds (*/sec) (glob)
267 267 updating to branch default
268 268 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
269 269 #endif
270 270
271 271 --pull should override server's preferuncompressed
272 272 $ hg clone --pull http://user:pass@localhost:$HGPORT2/ dest-pull 2>&1
273 273 requesting all changes
274 274 adding changesets
275 275 adding manifests
276 276 adding file changes
277 277 added 2 changesets with 5 changes to 5 files
278 278 new changesets 8b6053c928fe:5fed3813f7f5
279 279 updating to branch default
280 280 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
281 281
282 282 $ hg id http://user2@localhost:$HGPORT2/
283 283 abort: http authorization required for http://localhost:$HGPORT2/
284 284 [255]
285 285 $ hg id http://user:pass2@localhost:$HGPORT2/
286 286 abort: HTTP Error 403: no
287 287 [100]
288 288
289 289 $ hg -R dest-pull tag -r tip top
290 290 $ hg -R dest-pull push http://user:pass@localhost:$HGPORT2/
291 291 pushing to http://user:***@localhost:$HGPORT2/
292 292 searching for changes
293 293 remote: adding changesets
294 294 remote: adding manifests
295 295 remote: adding file changes
296 296 remote: added 1 changesets with 1 changes to 1 files
297 297 $ hg rollback -q
298 298 $ hg -R dest-pull push http://user:pass@localhost:$HGPORT2/ --debug --config devel.debug.peer-request=yes
299 299 pushing to http://user:***@localhost:$HGPORT2/
300 300 using http://localhost:$HGPORT2/
301 301 http auth: user user, password ****
302 302 sending capabilities command
303 303 devel-peer-request: GET http://localhost:$HGPORT2/?cmd=capabilities
304 304 http auth: user user, password ****
305 305 devel-peer-request: finished in *.???? seconds (200) (glob)
306 306 query 1; heads
307 307 devel-peer-request: batched-content
308 308 devel-peer-request: - heads (0 arguments)
309 309 devel-peer-request: - known (1 arguments)
310 310 sending batch command
311 311 devel-peer-request: GET http://localhost:$HGPORT2/?cmd=batch
312 312 devel-peer-request: Vary X-HgArg-1,X-HgProto-1
313 313 devel-peer-request: X-hgproto-1 0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
314 314 devel-peer-request: 68 bytes of commands arguments in headers
315 315 devel-peer-request: finished in *.???? seconds (200) (glob)
316 316 searching for changes
317 317 all remote heads known locally
318 318 preparing listkeys for "phases"
319 319 sending listkeys command
320 320 devel-peer-request: GET http://localhost:$HGPORT2/?cmd=listkeys
321 321 devel-peer-request: Vary X-HgArg-1,X-HgProto-1
322 322 devel-peer-request: X-hgproto-1 0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
323 323 devel-peer-request: 16 bytes of commands arguments in headers
324 324 devel-peer-request: finished in *.???? seconds (200) (glob)
325 325 received listkey for "phases": 58 bytes
326 326 checking for updated bookmarks
327 327 preparing listkeys for "bookmarks"
328 328 sending listkeys command
329 329 devel-peer-request: GET http://localhost:$HGPORT2/?cmd=listkeys
330 330 devel-peer-request: Vary X-HgArg-1,X-HgProto-1
331 331 devel-peer-request: X-hgproto-1 0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
332 332 devel-peer-request: 19 bytes of commands arguments in headers
333 333 devel-peer-request: finished in *.???? seconds (200) (glob)
334 334 received listkey for "bookmarks": 0 bytes
335 335 sending branchmap command
336 336 devel-peer-request: GET http://localhost:$HGPORT2/?cmd=branchmap
337 337 devel-peer-request: Vary X-HgProto-1
338 338 devel-peer-request: X-hgproto-1 0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
339 339 devel-peer-request: finished in *.???? seconds (200) (glob)
340 340 preparing listkeys for "bookmarks"
341 341 sending listkeys command
342 342 devel-peer-request: GET http://localhost:$HGPORT2/?cmd=listkeys
343 343 devel-peer-request: Vary X-HgArg-1,X-HgProto-1
344 344 devel-peer-request: X-hgproto-1 0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
345 345 devel-peer-request: 19 bytes of commands arguments in headers
346 346 devel-peer-request: finished in *.???? seconds (200) (glob)
347 347 received listkey for "bookmarks": 0 bytes
348 348 1 changesets found
349 349 list of changesets:
350 350 7f4e523d01f2cc3765ac8934da3d14db775ff872
351 351 bundle2-output-bundle: "HG20", 5 parts total
352 352 bundle2-output-part: "replycaps" 207 bytes payload
353 353 bundle2-output-part: "check:phases" 24 bytes payload
354 354 bundle2-output-part: "check:updated-heads" streamed payload
355 355 bundle2-output-part: "changegroup" (params: 1 mandatory) streamed payload
356 356 bundle2-output-part: "phase-heads" 24 bytes payload
357 357 sending unbundle command
358 358 sending 1023 bytes
359 359 devel-peer-request: POST http://localhost:$HGPORT2/?cmd=unbundle
360 360 devel-peer-request: Content-length 1023
361 361 devel-peer-request: Content-type application/mercurial-0.1
362 362 devel-peer-request: Vary X-HgArg-1,X-HgProto-1
363 363 devel-peer-request: X-hgproto-1 0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
364 364 devel-peer-request: 16 bytes of commands arguments in headers
365 365 devel-peer-request: 1023 bytes of data
366 366 devel-peer-request: finished in *.???? seconds (200) (glob)
367 367 bundle2-input-bundle: no-transaction
368 368 bundle2-input-part: "reply:changegroup" (advisory) (params: 0 advisory) supported
369 369 bundle2-input-part: "output" (advisory) (params: 0 advisory) supported
370 370 bundle2-input-part: total payload size 55
371 371 remote: adding changesets
372 372 remote: adding manifests
373 373 remote: adding file changes
374 374 bundle2-input-part: "output" (advisory) supported
375 375 bundle2-input-part: total payload size 45
376 376 remote: added 1 changesets with 1 changes to 1 files
377 377 bundle2-input-bundle: 3 parts total
378 378 preparing listkeys for "phases"
379 379 sending listkeys command
380 380 devel-peer-request: GET http://localhost:$HGPORT2/?cmd=listkeys
381 381 devel-peer-request: Vary X-HgArg-1,X-HgProto-1
382 382 devel-peer-request: X-hgproto-1 0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
383 383 devel-peer-request: 16 bytes of commands arguments in headers
384 384 devel-peer-request: finished in *.???? seconds (200) (glob)
385 385 received listkey for "phases": 15 bytes
386 386 (sent 9 HTTP requests and * bytes; received * bytes in responses) (glob) (?)
387 387 $ hg rollback -q
388 388
389 389 $ sed 's/.*] "/"/' < ../access.log
390 390 "GET /?cmd=capabilities HTTP/1.1" 401 -
391 391 "GET /?cmd=capabilities HTTP/1.1" 401 -
392 392 "GET /?cmd=capabilities HTTP/1.1" 401 -
393 393 "GET /?cmd=capabilities HTTP/1.1" 401 -
394 394 "GET /?cmd=capabilities HTTP/1.1" 401 -
395 395 "GET /?cmd=capabilities HTTP/1.1" 401 -
396 396 "GET /?cmd=capabilities HTTP/1.1" 200 -
397 397 "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
398 398 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
399 399 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
400 400 "GET /?cmd=capabilities HTTP/1.1" 401 -
401 401 "GET /?cmd=capabilities HTTP/1.1" 200 -
402 402 "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
403 403 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
404 404 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
405 405 "GET /?cmd=capabilities HTTP/1.1" 401 -
406 406 "GET /?cmd=capabilities HTTP/1.1" 200 -
407 407 "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
408 408 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
409 409 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
410 410 "GET /?cmd=capabilities HTTP/1.1" 401 -
411 411 "GET /?cmd=capabilities HTTP/1.1" 200 -
412 412 "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
413 413 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
414 414 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
415 415 "GET /?cmd=capabilities HTTP/1.1" 401 -
416 416 "GET /?cmd=capabilities HTTP/1.1" 200 -
417 417 "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
418 418 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
419 419 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
420 420 "GET /?cmd=capabilities HTTP/1.1" 401 - x-hgtest-authtype:Digest
421 421 "GET /?cmd=capabilities HTTP/1.1" 200 - x-hgtest-authtype:Digest
422 422 "GET /?cmd=lookup HTTP/1.1" 401 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull x-hgtest-authtype:Digest
423 423 "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull x-hgtest-authtype:Digest
424 424 "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull x-hgtest-authtype:Digest
425 425 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull x-hgtest-authtype:Digest
426 426 "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull x-hgtest-authtype:Digest
427 427 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull x-hgtest-authtype:Digest
428 428 "GET /?cmd=capabilities HTTP/1.1" 401 - (no-reposimplestore !)
429 429 "GET /?cmd=capabilities HTTP/1.1" 200 - (no-reposimplestore !)
430 430 "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 (no-reposimplestore !)
431 431 "GET /?cmd=getbundle HTTP/1.1" 200 - x-hgarg-1:bookmarks=1&$USUAL_BUNDLE_CAPS$&cg=0&common=0000000000000000000000000000000000000000&heads=5fed3813f7f5e1824344fdc9cf8f63bb662c292d&listkeys=bookmarks&stream=1 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (no-reposimplestore !)
432 432 "GET /?cmd=capabilities HTTP/1.1" 401 - (no-reposimplestore !)
433 433 "GET /?cmd=capabilities HTTP/1.1" 200 - (no-reposimplestore !)
434 434 "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
435 435 "GET /?cmd=getbundle HTTP/1.1" 200 - x-hgarg-1:bookmarks=1&$USUAL_BUNDLE_CAPS$&cg=1&common=0000000000000000000000000000000000000000&heads=5fed3813f7f5e1824344fdc9cf8f63bb662c292d&listkeys=bookmarks&phases=1 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
436 436 "GET /?cmd=capabilities HTTP/1.1" 401 -
437 437 "GET /?cmd=capabilities HTTP/1.1" 401 -
438 438 "GET /?cmd=capabilities HTTP/1.1" 403 -
439 439 "GET /?cmd=capabilities HTTP/1.1" 401 -
440 440 "GET /?cmd=capabilities HTTP/1.1" 200 -
441 441 "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
442 442 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
443 443 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
444 444 "GET /?cmd=branchmap HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
445 445 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
446 446 "POST /?cmd=unbundle HTTP/1.1" 200 - x-hgarg-1:heads=666f726365* (glob)
447 447 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
448 448 "GET /?cmd=capabilities HTTP/1.1" 401 -
449 449 "GET /?cmd=capabilities HTTP/1.1" 200 -
450 450 "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
451 451 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
452 452 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
453 453 "GET /?cmd=branchmap HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
454 454 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
455 455 "POST /?cmd=unbundle HTTP/1.1" 200 - x-hgarg-1:heads=666f726365 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
456 456 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
457 457
458 458 $ cd ..
459 459
460 460 clone of serve with repo in root and unserved subrepo (issue2970)
461 461
462 462 $ hg --cwd test init sub
463 463 $ echo empty > test/sub/empty
464 464 $ hg --cwd test/sub add empty
465 465 $ hg --cwd test/sub commit -qm 'add empty'
466 466 $ hg --cwd test/sub tag -r 0 something
467 467 $ echo sub = sub > test/.hgsub
468 468 $ hg --cwd test add .hgsub
469 469 $ hg --cwd test commit -qm 'add subrepo'
470 470 $ hg clone http://localhost:$HGPORT noslash-clone
471 471 requesting all changes
472 472 adding changesets
473 473 adding manifests
474 474 adding file changes
475 475 added 3 changesets with 7 changes to 7 files
476 476 new changesets 8b6053c928fe:56f9bc90cce6
477 477 updating to branch default
478 478 cloning subrepo sub from http://localhost:$HGPORT/sub
479 479 abort: HTTP Error 404: Not Found
480 480 [100]
481 481 $ hg clone http://localhost:$HGPORT/ slash-clone
482 482 requesting all changes
483 483 adding changesets
484 484 adding manifests
485 485 adding file changes
486 486 added 3 changesets with 7 changes to 7 files
487 487 new changesets 8b6053c928fe:56f9bc90cce6
488 488 updating to branch default
489 489 cloning subrepo sub from http://localhost:$HGPORT/sub
490 490 abort: HTTP Error 404: Not Found
491 491 [100]
492 492
493 493 check error log
494 494
495 495 $ cat error.log
496 496
497 497 $ cat errors2.log
498 498
499 499 check abort error reporting while pulling/cloning
500 500
501 501 $ $RUNTESTDIR/killdaemons.py
502 502 $ hg serve -R test -p $HGPORT -d --pid-file=hg3.pid -E error.log --config extensions.crash=${TESTDIR}/crashgetbundler.py
503 503 $ cat hg3.pid >> $DAEMON_PIDS
504 504 $ hg clone http://localhost:$HGPORT/ abort-clone
505 505 requesting all changes
506 506 remote: abort: this is an exercise
507 507 abort: pull failed on remote
508 508 [100]
509 509 $ cat error.log
510 510
511 511 disable pull-based clones
512 512
513 513 $ hg serve -R test -p $HGPORT1 -d --pid-file=hg4.pid -E error.log --config server.disablefullbundle=True
514 514 $ cat hg4.pid >> $DAEMON_PIDS
515 515 $ hg clone http://localhost:$HGPORT1/ disable-pull-clone
516 516 requesting all changes
517 517 remote: abort: server has pull-based clones disabled
518 518 abort: pull failed on remote
519 519 (remove --pull if specified or upgrade Mercurial)
520 520 [100]
521 521
522 522 #if no-reposimplestore
523 523 ... but keep stream clones working
524 524
525 525 $ hg clone --stream --noupdate http://localhost:$HGPORT1/ test-stream-clone
526 526 streaming all changes
527 527 * files to transfer, * of data (glob)
528 528 transferred * in * seconds (*/sec) (glob)
529 529 $ cat error.log
530 530 #endif
531 531
532 532 ... and also keep partial clones and pulls working
533 533 $ hg clone http://localhost:$HGPORT1 --rev 0 test/partial/clone
534 534 adding changesets
535 535 adding manifests
536 536 adding file changes
537 537 added 1 changesets with 4 changes to 4 files
538 538 new changesets 8b6053c928fe
539 539 updating to branch default
540 540 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
541 541 $ hg pull -R test/partial/clone
542 542 pulling from http://localhost:$HGPORT1/
543 543 searching for changes
544 544 adding changesets
545 545 adding manifests
546 546 adding file changes
547 547 added 2 changesets with 3 changes to 3 files
548 548 new changesets 5fed3813f7f5:56f9bc90cce6
549 549 (run 'hg update' to get a working copy)
550 550
551 551 $ hg clone -U -r 0 test/partial/clone test/another/clone
552 552 adding changesets
553 553 adding manifests
554 554 adding file changes
555 555 added 1 changesets with 4 changes to 4 files
556 556 new changesets 8b6053c928fe
557 557
558 558 corrupt cookies file should yield a warning
559 559
560 560 $ cat > $TESTTMP/cookies.txt << EOF
561 561 > bad format
562 562 > EOF
563 563
564 564 $ hg --config auth.cookiefile=$TESTTMP/cookies.txt id http://localhost:$HGPORT/
565 565 (error loading cookie file $TESTTMP/cookies.txt: '*/cookies.txt' does not look like a Netscape format cookies file; continuing without cookies) (glob)
566 566 56f9bc90cce6
567 567
568 568 $ killdaemons.py
569 569
570 570 Create dummy authentication handler that looks for cookies. It doesn't do anything
571 571 useful. It just raises an HTTP 500 with details about the Cookie request header.
572 572 We raise HTTP 500 because its message is printed in the abort message.
573 573
574 574 $ cat > cookieauth.py << EOF
575 575 > from mercurial import util
576 576 > from mercurial.hgweb import common
577 577 > def perform_authentication(hgweb, req, op):
578 578 > cookie = req.headers.get(b'Cookie')
579 579 > if not cookie:
580 580 > raise common.ErrorResponse(common.HTTP_SERVER_ERROR, b'no-cookie')
581 581 > raise common.ErrorResponse(common.HTTP_SERVER_ERROR, b'Cookie: %s' % cookie)
582 582 > def extsetup(ui):
583 583 > common.permhooks.insert(0, perform_authentication)
584 584 > EOF
585 585
586 586 $ hg serve --config extensions.cookieauth=cookieauth.py -R test -p $HGPORT -d --pid-file=pid
587 587 $ cat pid > $DAEMON_PIDS
588 588
589 589 Request without cookie sent should fail due to lack of cookie
590 590
591 591 $ hg id http://localhost:$HGPORT
592 592 abort: HTTP Error 500: no-cookie
593 593 [100]
594 594
595 595 Populate a cookies file
596 596
597 597 $ cat > cookies.txt << EOF
598 598 > # HTTP Cookie File
599 599 > # Expiration is 2030-01-01 at midnight
600 600 > .example.com TRUE / FALSE 1893456000 hgkey examplevalue
601 601 > EOF
602 602
603 603 Should not send a cookie for another domain
604 604
605 605 $ hg --config auth.cookiefile=cookies.txt id http://localhost:$HGPORT/
606 606 abort: HTTP Error 500: no-cookie
607 607 [100]
608 608
609 609 Add a cookie entry for our test server and verify it is sent
610 610
611 611 $ cat >> cookies.txt << EOF
612 612 > localhost.local FALSE / FALSE 1893456000 hgkey localhostvalue
613 613 > EOF
614 614
615 615 $ hg --config auth.cookiefile=cookies.txt id http://localhost:$HGPORT/
616 616 abort: HTTP Error 500: Cookie: hgkey=localhostvalue
617 617 [100]
@@ -1,452 +1,452 b''
1 1 #testcases sshv1 sshv2
2 2
3 3 #if sshv2
4 4 $ cat >> $HGRCPATH << EOF
5 5 > [experimental]
6 6 > sshpeer.advertise-v2 = true
7 7 > sshserver.support-v2 = true
8 8 > EOF
9 9 #endif
10 10
11 11 This file contains testcases that tend to be related to the wire protocol part
12 12 of largefiles.
13 13
14 14 $ USERCACHE="$TESTTMP/cache"; export USERCACHE
15 15 $ mkdir "${USERCACHE}"
16 16 $ cat >> $HGRCPATH <<EOF
17 17 > [extensions]
18 18 > largefiles=
19 19 > purge=
20 20 > rebase=
21 21 > transplant=
22 22 > [phases]
23 23 > publish=False
24 24 > [largefiles]
25 25 > minsize=2
26 26 > patterns=glob:**.dat
27 27 > usercache=${USERCACHE}
28 28 > [web]
29 29 > allow-archive = zip
30 30 > [hooks]
31 31 > precommit=sh -c "echo \\"Invoking status precommit hook\\"; hg status"
32 32 > EOF
33 33
34 34
35 35 #if serve
36 36 vanilla clients not locked out from largefiles servers on vanilla repos
37 37 $ mkdir r1
38 38 $ cd r1
39 39 $ hg init
40 40 $ echo c1 > f1
41 41 $ hg add f1
42 42 $ hg commit -m "m1"
43 43 Invoking status precommit hook
44 44 A f1
45 45 $ cd ..
46 46 $ hg serve -R r1 -d -p $HGPORT --pid-file hg.pid
47 47 $ cat hg.pid >> $DAEMON_PIDS
48 48 $ hg --config extensions.largefiles=! clone http://localhost:$HGPORT r2
49 49 requesting all changes
50 50 adding changesets
51 51 adding manifests
52 52 adding file changes
53 53 added 1 changesets with 1 changes to 1 files
54 54 new changesets b6eb3a2e2efe (1 drafts)
55 55 updating to branch default
56 56 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
57 57
58 58 largefiles clients still work with vanilla servers
59 59 $ hg serve --config extensions.largefiles=! -R r1 -d -p $HGPORT1 --pid-file hg.pid
60 60 $ cat hg.pid >> $DAEMON_PIDS
61 61 $ hg clone http://localhost:$HGPORT1 r3
62 62 requesting all changes
63 63 adding changesets
64 64 adding manifests
65 65 adding file changes
66 66 added 1 changesets with 1 changes to 1 files
67 67 new changesets b6eb3a2e2efe (1 drafts)
68 68 updating to branch default
69 69 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
70 70 #endif
71 71
72 72 vanilla clients locked out from largefiles http repos
73 73 $ mkdir r4
74 74 $ cd r4
75 75 $ hg init
76 76 $ echo c1 > f1
77 77 $ hg add --large f1
78 78 $ hg commit -m "m1"
79 79 Invoking status precommit hook
80 80 A f1
81 81 $ cd ..
82 82
83 83 largefiles can be pushed locally (issue3583)
84 84 $ hg init dest
85 85 $ cd r4
86 86 $ hg outgoing ../dest
87 87 comparing with ../dest
88 88 searching for changes
89 89 changeset: 0:639881c12b4c
90 90 tag: tip
91 91 user: test
92 92 date: Thu Jan 01 00:00:00 1970 +0000
93 93 summary: m1
94 94
95 95 $ hg push ../dest
96 96 pushing to ../dest
97 97 searching for changes
98 98 adding changesets
99 99 adding manifests
100 100 adding file changes
101 101 added 1 changesets with 1 changes to 1 files
102 102
103 103 exit code with nothing outgoing (issue3611)
104 104 $ hg outgoing ../dest
105 105 comparing with ../dest
106 106 searching for changes
107 107 no changes found
108 108 [1]
109 109 $ cd ..
110 110
111 111 #if serve
112 112 $ hg serve -R r4 -d -p $HGPORT2 --pid-file hg.pid
113 113 $ cat hg.pid >> $DAEMON_PIDS
114 114 $ hg --config extensions.largefiles=! clone http://localhost:$HGPORT2 r5
115 115 abort: remote error:
116 116
117 117 This repository uses the largefiles extension.
118 118
119 119 Please enable it in your Mercurial config file.
120 120 [100]
121 121
122 122 used all HGPORTs, kill all daemons
123 123 $ killdaemons.py
124 124 #endif
125 125
126 126 vanilla clients locked out from largefiles ssh repos
127 127 $ hg --config extensions.largefiles=! clone -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" ssh://user@dummy/r4 r5
128 128 remote:
129 129 remote: This repository uses the largefiles extension.
130 130 remote:
131 131 remote: Please enable it in your Mercurial config file.
132 132 remote:
133 133 remote: -
134 134 abort: remote error
135 135 (check previous remote output)
136 136 [100]
137 137
138 138 #if serve
139 139
140 140 largefiles clients refuse to push largefiles repos to vanilla servers
141 141 $ mkdir r6
142 142 $ cd r6
143 143 $ hg init
144 144 $ echo c1 > f1
145 145 $ hg add f1
146 146 $ hg commit -m "m1"
147 147 Invoking status precommit hook
148 148 A f1
149 149 $ cat >> .hg/hgrc <<!
150 150 > [web]
151 151 > push_ssl = false
152 152 > allow_push = *
153 153 > !
154 154 $ cd ..
155 155 $ hg clone r6 r7
156 156 updating to branch default
157 157 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
158 158 $ cd r7
159 159 $ echo c2 > f2
160 160 $ hg add --large f2
161 161 $ hg commit -m "m2"
162 162 Invoking status precommit hook
163 163 A f2
164 164 $ hg verify --large
165 165 checking changesets
166 166 checking manifests
167 167 crosschecking files in changesets and manifests
168 168 checking files
169 169 checked 2 changesets with 2 changes to 2 files
170 170 searching 1 changesets for largefiles
171 171 verified existence of 1 revisions of 1 largefiles
172 172 $ hg serve --config extensions.largefiles=! -R ../r6 -d -p $HGPORT --pid-file ../hg.pid
173 173 $ cat ../hg.pid >> $DAEMON_PIDS
174 174 $ hg push http://localhost:$HGPORT
175 175 pushing to http://localhost:$HGPORT/
176 176 searching for changes
177 177 abort: http://localhost:$HGPORT/ does not appear to be a largefile store
178 178 [255]
179 179 $ cd ..
180 180
181 181 putlfile errors are shown (issue3123)
182 182 Corrupt the cached largefile in r7 and move it out of the servers usercache
183 183 $ mv r7/.hg/largefiles/4cdac4d8b084d0b599525cf732437fb337d422a8 .
184 184 $ echo 'client side corruption' > r7/.hg/largefiles/4cdac4d8b084d0b599525cf732437fb337d422a8
185 185 $ rm "$USERCACHE/4cdac4d8b084d0b599525cf732437fb337d422a8"
186 186 $ hg init empty
187 187 $ hg serve -R empty -d -p $HGPORT1 --pid-file hg.pid \
188 188 > --config 'web.allow_push=*' --config web.push_ssl=False
189 189 $ cat hg.pid >> $DAEMON_PIDS
190 190 $ hg push -R r7 http://localhost:$HGPORT1
191 191 pushing to http://localhost:$HGPORT1/
192 192 searching for changes
193 193 remote: largefiles: failed to put 4cdac4d8b084d0b599525cf732437fb337d422a8 into store: largefile contents do not match hash
194 194 abort: remotestore: could not put $TESTTMP/r7/.hg/largefiles/4cdac4d8b084d0b599525cf732437fb337d422a8 to remote store http://localhost:$HGPORT1/
195 195 [255]
196 196 $ mv 4cdac4d8b084d0b599525cf732437fb337d422a8 r7/.hg/largefiles/4cdac4d8b084d0b599525cf732437fb337d422a8
197 197 Push of file that exists on server but is corrupted - magic healing would be nice ... but too magic
198 198 $ echo "server side corruption" > empty/.hg/largefiles/4cdac4d8b084d0b599525cf732437fb337d422a8
199 199 $ hg push -R r7 http://localhost:$HGPORT1
200 200 pushing to http://localhost:$HGPORT1/
201 201 searching for changes
202 202 remote: adding changesets
203 203 remote: adding manifests
204 204 remote: adding file changes
205 205 remote: added 2 changesets with 2 changes to 2 files
206 206 $ cat empty/.hg/largefiles/4cdac4d8b084d0b599525cf732437fb337d422a8
207 207 server side corruption
208 208 $ rm -rf empty
209 209
210 210 Push a largefiles repository to a served empty repository
211 211 $ hg init r8
212 212 $ echo c3 > r8/f1
213 213 $ hg add --large r8/f1 -R r8
214 214 $ hg commit -m "m1" -R r8
215 215 Invoking status precommit hook
216 216 A f1
217 217 $ hg init empty
218 218 $ hg serve -R empty -d -p $HGPORT2 --pid-file hg.pid \
219 219 > --config 'web.allow_push=*' --config web.push_ssl=False
220 220 $ cat hg.pid >> $DAEMON_PIDS
221 221 $ rm "${USERCACHE}"/*
222 222 $ hg push -R r8 http://localhost:$HGPORT2/#default
223 223 pushing to http://localhost:$HGPORT2/
224 224 searching for changes
225 225 remote: adding changesets
226 226 remote: adding manifests
227 227 remote: adding file changes
228 228 remote: added 1 changesets with 1 changes to 1 files
229 229 $ [ -f "${USERCACHE}"/02a439e5c31c526465ab1a0ca1f431f76b827b90 ]
230 230 $ [ -f empty/.hg/largefiles/02a439e5c31c526465ab1a0ca1f431f76b827b90 ]
231 231
232 232 Clone over http, no largefiles pulled on clone.
233 233
234 234 $ hg clone http://localhost:$HGPORT2/#default http-clone -U
235 235 adding changesets
236 236 adding manifests
237 237 adding file changes
238 238 added 1 changesets with 1 changes to 1 files
239 239 new changesets cf03e5bb9936 (1 drafts)
240 240
241 241 Archive contains largefiles
242 242 >>> import os
243 243 >>> from mercurial import urllibcompat
244 244 >>> u = 'http://localhost:%s/archive/default.zip' % os.environ['HGPORT2']
245 245 >>> with open('archive.zip', 'wb') as f:
246 246 ... f.write(urllibcompat.urlreq.urlopen(u).read()) and None
247 247 $ unzip -t archive.zip
248 248 Archive: archive.zip
249 249 testing: empty-default/.hg_archival.txt*OK (glob)
250 250 testing: empty-default/f1*OK (glob)
251 251 No errors detected in compressed data of archive.zip.
252 252
253 253 test 'verify' with remotestore:
254 254
255 255 $ rm "${USERCACHE}"/02a439e5c31c526465ab1a0ca1f431f76b827b90
256 256 $ mv empty/.hg/largefiles/02a439e5c31c526465ab1a0ca1f431f76b827b90 .
257 257 $ hg -R http-clone verify --large --lfa
258 258 checking changesets
259 259 checking manifests
260 260 crosschecking files in changesets and manifests
261 261 checking files
262 262 checked 1 changesets with 1 changes to 1 files
263 263 searching 1 changesets for largefiles
264 264 changeset 0:cf03e5bb9936: f1 missing
265 265 verified existence of 1 revisions of 1 largefiles
266 266 [1]
267 267 $ mv 02a439e5c31c526465ab1a0ca1f431f76b827b90 empty/.hg/largefiles/
268 268 $ hg -R http-clone -q verify --large --lfa
269 269
270 270 largefiles pulled on update - a largefile missing on the server:
271 271 $ mv empty/.hg/largefiles/02a439e5c31c526465ab1a0ca1f431f76b827b90 .
272 272 $ hg -R http-clone up --config largefiles.usercache=http-clone-usercache
273 273 getting changed largefiles
274 274 f1: largefile 02a439e5c31c526465ab1a0ca1f431f76b827b90 not available from http://localhost:$HGPORT2/
275 275 0 largefiles updated, 0 removed
276 276 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
277 277 $ hg -R http-clone st
278 278 ! f1
279 279 $ hg -R http-clone up -Cqr null
280 280
281 281 largefiles pulled on update - a largefile corrupted on the server:
282 282 $ echo corruption > empty/.hg/largefiles/02a439e5c31c526465ab1a0ca1f431f76b827b90
283 283 $ hg -R http-clone up --config largefiles.usercache=http-clone-usercache
284 284 getting changed largefiles
285 285 f1: data corruption (expected 02a439e5c31c526465ab1a0ca1f431f76b827b90, got 6a7bb2556144babe3899b25e5428123735bb1e27)
286 286 0 largefiles updated, 0 removed
287 287 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
288 288 $ hg -R http-clone st
289 289 ! f1
290 290 $ [ ! -f http-clone/.hg/largefiles/02a439e5c31c526465ab1a0ca1f431f76b827b90 ]
291 291 $ [ ! -f http-clone/f1 ]
292 292 $ [ ! -f http-clone-usercache ]
293 293 $ hg -R http-clone verify --large --lfc
294 294 checking changesets
295 295 checking manifests
296 296 crosschecking files in changesets and manifests
297 297 checking files
298 298 checked 1 changesets with 1 changes to 1 files
299 299 searching 1 changesets for largefiles
300 300 verified contents of 1 revisions of 1 largefiles
301 301 $ hg -R http-clone up -Cqr null
302 302
303 303 largefiles pulled on update - no server side problems:
304 304 $ mv 02a439e5c31c526465ab1a0ca1f431f76b827b90 empty/.hg/largefiles/
305 305 $ hg -R http-clone --debug up --config largefiles.usercache=http-clone-usercache --config progress.debug=true
306 306 resolving manifests
307 307 branchmerge: False, force: False, partial: False
308 308 ancestor: 000000000000, local: 000000000000+, remote: cf03e5bb9936
309 309 .hglf/f1: remote created -> g
310 310 getting .hglf/f1
311 311 updating: .hglf/f1 1/1 files (100.00%)
312 312 getting changed largefiles
313 313 using http://localhost:$HGPORT2/
314 314 sending capabilities command
315 315 sending statlfile command
316 316 getting largefiles: 0/1 files (0.00%)
317 317 getting f1:02a439e5c31c526465ab1a0ca1f431f76b827b90
318 318 sending getlfile command
319 319 found 02a439e5c31c526465ab1a0ca1f431f76b827b90 in store
320 320 1 largefiles updated, 0 removed
321 321 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
322 322
323 323 $ ls http-clone-usercache/*
324 324 http-clone-usercache/02a439e5c31c526465ab1a0ca1f431f76b827b90
325 325
326 326 $ rm -rf empty http-clone*
327 327
328 328 used all HGPORTs, kill all daemons
329 329 $ killdaemons.py
330 330
331 331 largefiles should batch verify remote calls
332 332
333 333 $ hg init batchverifymain
334 334 $ cd batchverifymain
335 335 $ echo "aaa" >> a
336 336 $ hg add --large a
337 337 $ hg commit -m "a"
338 338 Invoking status precommit hook
339 339 A a
340 340 $ echo "bbb" >> b
341 341 $ hg add --large b
342 342 $ hg commit -m "b"
343 343 Invoking status precommit hook
344 344 A b
345 345 $ cd ..
346 346 $ hg serve -R batchverifymain -d -p $HGPORT --pid-file hg.pid \
347 347 > -A access.log
348 348 $ cat hg.pid >> $DAEMON_PIDS
349 349 $ hg clone --noupdate http://localhost:$HGPORT batchverifyclone
350 350 requesting all changes
351 351 adding changesets
352 352 adding manifests
353 353 adding file changes
354 354 added 2 changesets with 2 changes to 2 files
355 355 new changesets 567253b0f523:04d19c27a332 (2 drafts)
356 356 $ hg -R batchverifyclone verify --large --lfa
357 357 checking changesets
358 358 checking manifests
359 359 crosschecking files in changesets and manifests
360 360 checking files
361 361 checked 2 changesets with 2 changes to 2 files
362 362 searching 2 changesets for largefiles
363 363 verified existence of 2 revisions of 2 largefiles
364 364 $ tail -1 access.log
365 365 $LOCALIP - - [$LOGDATE$] "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=statlfile+sha%3D972a1a11f19934401291cc99117ec614933374ce%3Bstatlfile+sha%3Dc801c9cfe94400963fcb683246217d5db77f9a9a x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (glob)
366 366 $ hg -R batchverifyclone update
367 367 getting changed largefiles
368 368 2 largefiles updated, 0 removed
369 369 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
370 370
371 371 Clear log file before next test
372 372
373 373 $ printf "" > access.log
374 374
375 375 Verify should check file on remote server only when file is not
376 376 available locally.
377 377
378 378 $ echo "ccc" >> batchverifymain/c
379 379 $ hg -R batchverifymain status
380 380 ? c
381 381 $ hg -R batchverifymain add --large batchverifymain/c
382 382 $ hg -R batchverifymain commit -m "c"
383 383 Invoking status precommit hook
384 384 A c
385 385 $ hg -R batchverifyclone pull
386 386 pulling from http://localhost:$HGPORT/
387 387 searching for changes
388 388 adding changesets
389 389 adding manifests
390 390 adding file changes
391 391 added 1 changesets with 1 changes to 1 files
392 392 new changesets 6bba8cb6935d (1 drafts)
393 393 (run 'hg update' to get a working copy)
394 394 $ hg -R batchverifyclone verify --lfa
395 395 checking changesets
396 396 checking manifests
397 397 crosschecking files in changesets and manifests
398 398 checking files
399 399 checked 3 changesets with 3 changes to 3 files
400 400 searching 3 changesets for largefiles
401 401 verified existence of 3 revisions of 3 largefiles
402 402 $ tail -1 access.log
403 403 $LOCALIP - - [$LOGDATE$] "GET /?cmd=statlfile HTTP/1.1" 200 - x-hgarg-1:sha=c8559c3c9cfb42131794b7d8009230403b9b454c x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (glob)
404 404
405 405 $ killdaemons.py
406 406
407 407 largefiles should not ask for password again after successful authorization
408 408
409 409 $ hg init credentialmain
410 410 $ cd credentialmain
411 411 $ echo "aaa" >> a
412 412 $ hg add --large a
413 413 $ hg commit -m "a"
414 414 Invoking status precommit hook
415 415 A a
416 416
417 417 Before running server clear the user cache to force clone to download
418 418 a large file from the server rather than to get it from the cache
419 419
420 420 $ rm "${USERCACHE}"/*
421 421
422 422 $ cd ..
423 423
424 424 $ hg serve --config extensions.x=$TESTDIR/httpserverauth.py -R credentialmain \
425 425 > -d -p $HGPORT --pid-file hg.pid -A access.log
426 426 $ cat hg.pid >> $DAEMON_PIDS
427 427 $ cat << EOF > get_pass.py
428 > import getpass
429 > def newgetpass(arg):
428 > from mercurial import util
429 > def newgetpass():
430 430 > return "pass"
431 > getpass.getpass = newgetpass
431 > util.get_password = newgetpass
432 432 > EOF
433 433 $ hg clone --config ui.interactive=true --config extensions.getpass=get_pass.py \
434 434 > http://user@localhost:$HGPORT credentialclone
435 435 http authorization required for http://localhost:$HGPORT/
436 436 realm: mercurial
437 437 user: user
438 438 password: requesting all changes
439 439 adding changesets
440 440 adding manifests
441 441 adding file changes
442 442 added 1 changesets with 1 changes to 1 files
443 443 new changesets 567253b0f523 (1 drafts)
444 444 updating to branch default
445 445 getting changed largefiles
446 446 1 largefiles updated, 0 removed
447 447 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
448 448
449 449 $ killdaemons.py
450 450 $ rm hg.pid access.log
451 451
452 452 #endif
General Comments 0
You need to be logged in to leave comments. Login now