Debian Codegraph @

tests/test-clonebundles.t

raw
1 Set up a server
2
3 $ hg init server
4 $ cd server
5 $ cat >> .hg/hgrc << EOF
6 > [extensions]
7 > clonebundles =
8 > EOF
9
10 $ touch foo
11 $ hg -q commit -A -m 'add foo'
12 $ touch bar
13 $ hg -q commit -A -m 'add bar'
14
15 $ hg serve -d -p $HGPORT --pid-file hg.pid --accesslog access.log
16 $ cat hg.pid >> $DAEMON_PIDS
17 $ cd ..
18
19 Missing manifest should not result in server lookup
20
21 $ hg debug::clonebundle-manifest http://localhost:$HGPORT
22 clonebundles not supported by peer
23 $ hg --verbose clone -U http://localhost:$HGPORT no-manifest
24 requesting all changes
25 adding changesets
26 adding manifests
27 adding file changes
28 added 2 changesets with 2 changes to 2 files
29 new changesets 53245c60e682:aaff8d2ffbbf
30 (sent 3 HTTP requests and * bytes; received * bytes in responses) (glob)
31
32 $ cat server/access.log
33 * - - [*] "GET /?cmd=capabilities HTTP/1.1" 200 - (glob)
34 $LOCALIP - - [$LOGDATE$] "GET /?cmd=capabilities HTTP/1.1" 200 - (glob)
35 $LOCALIP - - [$LOGDATE$] "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 (glob)
36 $LOCALIP - - [$LOGDATE$] "GET /?cmd=getbundle HTTP/1.1" 200 - x-hgarg-1:bookmarks=1&$USUAL_BUNDLE_CAPS$&cg=1&common=0000000000000000000000000000000000000000&heads=aaff8d2ffbbf07a46dd1f05d8ae7877e3f56e2a2&listkeys=bookmarks&phases=1 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (glob)
37
38 Empty manifest file results in retrieval
39 (the extension only checks if the manifest file exists)
40
41 $ touch server/.hg/clonebundles.manifest
42 $ hg debug::clonebundle-manifest http://localhost:$HGPORT --raw
43
44 $ hg debug::clonebundle-manifest http://localhost:$HGPORT
45 $ hg --verbose clone -U http://localhost:$HGPORT empty-manifest
46 no clone bundles available on remote; falling back to regular clone
47 requesting all changes
48 adding changesets
49 adding manifests
50 adding file changes
51 added 2 changesets with 2 changes to 2 files
52 new changesets 53245c60e682:aaff8d2ffbbf
53 (sent 4 HTTP requests and * bytes; received * bytes in responses) (glob)
54
55 Manifest file with invalid URL aborts
56
57 $ echo 'http://does.not.exist/bundle.hg' > server/.hg/clonebundles.manifest
58 $ hg debug::clonebundle-manifest http://localhost:$HGPORT --raw
59 http://does.not.exist/bundle.hg
60 $ hg debug::clonebundle-manifest http://localhost:$HGPORT
61 URL: http://does.not.exist/bundle.hg
62 $ hg clone http://localhost:$HGPORT 404-url
63 applying clone bundle from http://does.not.exist/bundle.hg
64 error fetching bundle: (.* not known|(\[Errno -?\d+] )?([Nn]o address associated with (host)?name|Temporary failure in name resolution|Name does not resolve)) (re) (no-windows !)
65 error fetching bundle: [Errno 1100*] getaddrinfo failed (glob) (windows !)
66 abort: error applying bundle
67 (if this error persists, consider contacting the server operator or disable clone bundles via "--config ui.clonebundles=false")
68 [255]
69
70 Manifest file with URL with unknown scheme skips the URL
71 $ echo 'weirdscheme://does.not.exist/bundle.hg' > server/.hg/clonebundles.manifest
72 $ hg debug::clonebundle-manifest http://localhost:$HGPORT --raw
73 weirdscheme://does.not.exist/bundle.hg
74 $ hg debug::clonebundle-manifest http://localhost:$HGPORT
75 $ hg clone http://localhost:$HGPORT unknown-scheme
76 no compatible clone bundles available on server; falling back to regular clone
77 (you may want to report this to the server operator)
78 requesting all changes
79 adding changesets
80 adding manifests
81 adding file changes
82 added 2 changesets with 2 changes to 2 files
83 new changesets 53245c60e682:aaff8d2ffbbf
84 updating to branch default
85 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
86
87 Server is not running aborts
88
89 $ echo "http://localhost:$HGPORT1/bundle.hg" > server/.hg/clonebundles.manifest
90 $ hg debug::clonebundle-manifest http://localhost:$HGPORT --raw
91 http://localhost:$HGPORT1/bundle.hg
92 $ hg debug::clonebundle-manifest http://localhost:$HGPORT
93 URL: http://localhost:$HGPORT1/bundle.hg
94 $ hg clone http://localhost:$HGPORT server-not-runner
95 applying clone bundle from http://localhost:$HGPORT1/bundle.hg
96 error fetching bundle: (.*\$ECONNREFUSED\$|Protocol not supported|(.* )?\$EADDRNOTAVAIL\$|.* No route to host) (re)
97 abort: error applying bundle
98 (if this error persists, consider contacting the server operator or disable clone bundles via "--config ui.clonebundles=false")
99 [255]
100
101 Server returns 404
102
103 $ "$PYTHON" $TESTDIR/dumbhttp.py -p $HGPORT1 --pid http.pid
104 $ cat http.pid >> $DAEMON_PIDS
105 $ hg clone http://localhost:$HGPORT running-404
106 applying clone bundle from http://localhost:$HGPORT1/bundle.hg
107 HTTP error fetching bundle: HTTP Error 404: File not found
108 abort: error applying bundle
109 (if this error persists, consider contacting the server operator or disable clone bundles via "--config ui.clonebundles=false")
110 [255]
111
112 We can override failure to fall back to regular clone
113
114 $ hg --config ui.clonebundlefallback=true clone -U http://localhost:$HGPORT 404-fallback
115 applying clone bundle from http://localhost:$HGPORT1/bundle.hg
116 HTTP error fetching bundle: HTTP Error 404: File not found
117 falling back to normal clone
118 requesting all changes
119 adding changesets
120 adding manifests
121 adding file changes
122 added 2 changesets with 2 changes to 2 files
123 new changesets 53245c60e682:aaff8d2ffbbf
124
125 Bundle with partial content works
126
127 $ hg -R server bundle --type gzip-v1 --base null -r 53245c60e682 partial.hg
128 1 changesets found
129
130 We verify exact bundle content as an extra check against accidental future
131 changes. If this output changes, we could break old clients.
132
133 $ f --size --hexdump partial.hg
134 partial.hg: size=207
135 0000: 48 47 31 30 47 5a 78 9c 63 60 60 98 17 ac 12 93 |HG10GZx.c``.....|
136 0010: f0 ac a9 23 45 70 cb bf 0d 5f 59 4e 4a 7f 79 21 |...#Ep..._YNJ.y!|
137 0020: 9b cc 40 24 20 a0 d7 ce 2c d1 38 25 cd 24 25 d5 |..@$ ...,.8%.$%.|
138 0030: d8 c2 22 cd 38 d9 24 cd 22 d5 c8 22 cd 24 cd 32 |..".8.$."..".$.2|
139 0040: d1 c2 d0 c4 c8 d2 32 d1 38 39 29 c9 34 cd d4 80 |......2.89).4...|
140 0050: ab 24 b5 b8 84 cb 40 c1 80 2b 2d 3f 9f 8b 2b 31 |.$....@..+-?..+1|
141 0060: 25 45 01 c8 80 9a d2 9b 65 fb e5 9e 45 bf 8d 7f |%E......e...E...|
142 0070: 9f c6 97 9f 2b 44 34 67 d9 ec 8e 0f a0 92 0b 75 |....+D4g.......u|
143 0080: 41 d6 24 59 18 a4 a4 9a a6 18 1a 5b 98 9b 5a 98 |A.$Y.......[..Z.|
144 0090: 9a 18 26 9b a6 19 98 1a 99 99 26 a6 18 9a 98 24 |..&.......&....$|
145 00a0: 26 59 a6 25 5a 98 a5 18 a6 24 71 41 35 b1 43 dc |&Y.%Z....$qA5.C.|
146 00b0: 16 b2 83 f7 e9 45 8b d2 56 c7 a3 1f 82 52 d7 8a |.....E..V....R..|
147 00c0: 78 ed fc d5 76 f1 36 35 dc 05 00 36 ed 5e c7 |x...v.65...6.^.|
148
149 $ echo "http://localhost:$HGPORT1/partial.hg" > server/.hg/clonebundles.manifest
150 $ hg debug::clonebundle-manifest http://localhost:$HGPORT --raw
151 http://localhost:$HGPORT1/partial.hg
152 $ hg debug::clonebundle-manifest http://localhost:$HGPORT
153 URL: http://localhost:$HGPORT1/partial.hg
154 $ hg clone -U http://localhost:$HGPORT partial-bundle
155 applying clone bundle from http://localhost:$HGPORT1/partial.hg
156 adding changesets
157 adding manifests
158 adding file changes
159 added 1 changesets with 1 changes to 1 files
160 finished applying clone bundle
161 searching for changes
162 adding changesets
163 adding manifests
164 adding file changes
165 added 1 changesets with 1 changes to 1 files
166 new changesets aaff8d2ffbbf
167 1 local changesets published
168
169 Incremental pull doesn't fetch bundle
170
171 $ hg clone -r 53245c60e682 -U http://localhost:$HGPORT partial-clone
172 adding changesets
173 adding manifests
174 adding file changes
175 added 1 changesets with 1 changes to 1 files
176 new changesets 53245c60e682
177
178 $ cd partial-clone
179 $ hg pull
180 pulling from http://localhost:$HGPORT/
181 searching for changes
182 adding changesets
183 adding manifests
184 adding file changes
185 added 1 changesets with 1 changes to 1 files
186 new changesets aaff8d2ffbbf
187 (run 'hg update' to get a working copy)
188 $ cd ..
189
190 Bundle with full content works
191
192 $ hg -R server bundle --type gzip-v2 --base null -r tip full.hg
193 2 changesets found
194
195 Again, we perform an extra check against bundle content changes. If this content
196 changes, clone bundles produced by new Mercurial versions may not be readable
197 by old clients.
198
199 $ f --size --hexdump full.hg
200 full.hg: size=442
201 0000: 48 47 32 30 00 00 00 0e 43 6f 6d 70 72 65 73 73 |HG20....Compress|
202 0010: 69 6f 6e 3d 47 5a 78 9c 63 60 60 d0 e4 76 f6 70 |ion=GZx.c``..v.p|
203 0020: f4 73 77 75 0f f2 0f 0d 60 00 02 46 46 76 26 4e |.swu....`..FFv&N|
204 0030: c6 b2 d4 a2 e2 cc fc 3c 03 a3 bc a4 e4 8c c4 bc |.......<........|
205 0040: f4 d4 62 23 06 06 e6 19 40 f9 4d c1 2a 31 09 cf |..b#[email protected].*1..|
206 0050: 9a 3a 52 04 b7 fc db f0 95 e5 a4 f4 97 17 b2 c9 |.:R.............|
207 0060: 0c 14 00 02 e6 d9 99 25 1a a7 a4 99 a4 a4 1a 5b |.......%.......[|
208 0070: 58 a4 19 27 9b a4 59 a4 1a 59 a4 99 a4 59 26 5a |X..'..Y..Y...Y&Z|
209 0080: 18 9a 18 59 5a 26 1a 27 27 25 99 a6 99 1a 70 95 |...YZ&.''%....p.|
210 0090: a4 16 97 70 19 28 18 70 a5 e5 e7 73 71 25 a6 a4 |...p.(.p...sq%..|
211 00a0: 28 00 19 20 17 af fa df ab ff 7b 3f fb 92 dc 8b |(.. ......{?....|
212 00b0: 1f 62 bb 9e b7 d7 d9 87 3d 5a 44 89 2f b0 99 87 |.b......=ZD./...|
213 00c0: ec e2 54 63 43 e3 b4 64 43 73 23 33 43 53 0b 63 |..TcC..dCs#3CS.c|
214 00d0: d3 14 23 03 a0 fb 2c 2c 0c d3 80 1e 30 49 49 b1 |..#...,,....0II.|
215 00e0: 4c 4a 32 48 33 30 b0 34 42 b8 38 29 b1 08 e2 62 |LJ2H30.4B.8)...b|
216 00f0: 20 03 6a ca c2 2c db 2f f7 2c fa 6d fc fb 34 be | .j..,./.,.m..4.|
217 0100: fc 5c 21 a2 39 cb 66 77 7c 00 0d c3 59 17 14 58 |.\!.9.fw|...Y..X|
218 0110: 49 16 06 29 a9 a6 29 86 c6 16 e6 a6 16 a6 26 86 |I..)..).......&.|
219 0120: c9 a6 69 06 a6 46 66 a6 89 29 86 26 26 89 49 96 |..i..Ff..).&&.I.|
220 0130: 69 89 16 66 29 86 29 49 5c 20 07 3e 16 fe 23 ae |i..f).)I\ .>..#.|
221 0140: 26 da 1c ab 10 1f d1 f8 e3 b3 ef cd dd fc 0c 93 |&...............|
222 0150: 88 75 34 36 75 04 82 55 17 14 36 a4 38 10 04 d8 |.u46u..U..6.8...|
223 0160: 21 01 9a b1 83 f7 e9 45 8b d2 56 c7 a3 1f 82 52 |!......E..V....R|
224 0170: d7 8a 78 ed fc d5 76 f1 36 25 81 89 c7 ad ec 90 |..x...v.6%......|
225 0180: 54 47 75 2b 89 48 b1 b2 62 c9 89 c9 19 a9 56 45 |TGu+.H..b.....VE|
226 0190: a9 65 ba 49 45 89 79 c9 19 ba 60 01 a0 14 23 58 |.e.IE.y...`...#X|
227 01a0: 81 35 c8 7d 40 cc 04 e2 a4 a4 a6 25 96 e6 94 60 |.5.}@......%...`|
228 01b0: 33 17 5f 54 00 00 d3 1b 0d 4c |3._T.....L|
229
230 $ echo "http://localhost:$HGPORT1/full.hg" > server/.hg/clonebundles.manifest
231 $ hg debug::clonebundle-manifest http://localhost:$HGPORT --raw
232 http://localhost:$HGPORT1/full.hg
233 $ hg debug::clonebundle-manifest http://localhost:$HGPORT
234 URL: http://localhost:$HGPORT1/full.hg
235 $ hg clone -U http://localhost:$HGPORT full-bundle
236 applying clone bundle from http://localhost:$HGPORT1/full.hg
237 adding changesets
238 adding manifests
239 adding file changes
240 added 2 changesets with 2 changes to 2 files
241 finished applying clone bundle
242 searching for changes
243 no changes found
244 2 local changesets published
245
246 Feature works over SSH
247
248 $ hg clone -U ssh://user@dummy/server ssh-full-clone
249 applying clone bundle from http://localhost:$HGPORT1/full.hg
250 adding changesets
251 adding manifests
252 adding file changes
253 added 2 changesets with 2 changes to 2 files
254 finished applying clone bundle
255 searching for changes
256 no changes found
257 2 local changesets published
258
259 Inline bundle
260 =============
261
262 Checking bundle retrieved over the wireprotocol
263
264 Feature works over SSH with inline bundle
265 -----------------------------------------
266
267 $ mkdir server/.hg/bundle-cache/
268 $ cp full.hg server/.hg/bundle-cache/
269 $ echo "peer-bundle-cache://full.hg" > server/.hg/clonebundles.manifest
270 $ hg debug::clonebundle-manifest http://localhost:$HGPORT --raw
271 peer-bundle-cache://full.hg
272 $ hg debug::clonebundle-manifest http://localhost:$HGPORT
273 URL: peer-bundle-cache://full.hg
274 $ hg clone -U ssh://user@dummy/server ssh-inline-clone
275 applying clone bundle from peer-bundle-cache://full.hg
276 adding changesets
277 adding manifests
278 adding file changes
279 added 2 changesets with 2 changes to 2 files
280 finished applying clone bundle
281 searching for changes
282 no changes found
283 2 local changesets published
284
285 Out-of-repo storage for inline bundle
286 -------------------------------------
287
288 $ cp -R server server-extern
289 $ cat >> server-extern/.hg/hgrc << EOF
290 > [server]
291 > peer-bundle-cache-root = `pwd`/server/.hg/bundle-cache
292 > EOF
293 $ rm -r server-extern/.hg/bundle-cache
294 $ hg clone -U ssh://user@dummy/server-extern ssh-inline-clone-extern
295 applying clone bundle from peer-bundle-cache://full.hg
296 adding changesets
297 adding manifests
298 adding file changes
299 added 2 changesets with 2 changes to 2 files
300 finished applying clone bundle
301 searching for changes
302 no changes found
303 2 local changesets published
304
305 HTTP Supports
306 -------------
307
308 $ hg clone -U http://localhost:$HGPORT http-inline-clone
309 applying clone bundle from peer-bundle-cache://full.hg
310 adding changesets
311 adding manifests
312 adding file changes
313 added 2 changesets with 2 changes to 2 files
314 finished applying clone bundle
315 searching for changes
316 no changes found
317 2 local changesets published
318
319
320 Check local behavior
321 --------------------
322
323 We don't use the clone bundle, but we do not crash either.
324
325 $ hg clone -U ./server local-inline-clone-default
326 $ hg clone -U ./server local-inline-clone-pull --pull
327 requesting all changes
328 adding changesets
329 adding manifests
330 adding file changes
331 added 2 changesets with 2 changes to 2 files
332 new changesets 53245c60e682:aaff8d2ffbbf
333
334 Pre-transmit Hook
335 -----------------
336
337 Hooks work with inline bundle
338
339 $ cp server/.hg/hgrc server/.hg/hgrc-beforeinlinehooks
340 $ cat >> server/.hg/hgrc <<-EOF
341 > [hooks]
342 > pretransmit-inline-clone-bundle=sh -c 'printf "foo\n"'
343 > EOF
344 $ hg clone -U ssh://user@dummy/server ssh-inline-clone-hook
345 applying clone bundle from peer-bundle-cache://full.hg
346 remote: foo
347 adding changesets
348 adding manifests
349 adding file changes
350 added 2 changesets with 2 changes to 2 files
351 finished applying clone bundle
352 searching for changes
353 no changes found
354 2 local changesets published
355
356 Hooks can make an inline bundle fail
357
358 $ cp server/.hg/hgrc-beforeinlinehooks server/.hg/hgrc
359 $ cat >> server/.hg/hgrc <<-EOF
360 > [hooks]
361 > pretransmit-inline-clone-bundle=sh -c 'printf "bar\n"' && false
362 > EOF
363 $ hg clone -U ssh://user@dummy/server ssh-inline-clone-hook-fail
364 applying clone bundle from peer-bundle-cache://full.hg
365 remote: bar
366 remote: abort: pretransmit-inline-clone-bundle hook exited with status 1
367 abort: stream ended unexpectedly (got 0 bytes, expected 1)
368 [255]
369 $ cp server/.hg/hgrc-beforeinlinehooks server/.hg/hgrc
370
371 Other tests
372 ===========
373
374 Entry with unknown BUNDLESPEC is filtered and not used
375
376 $ cat > server/.hg/clonebundles.manifest << EOF
377 > http://bad.entry1 BUNDLESPEC=UNKNOWN
378 > http://bad.entry2 BUNDLESPEC=xz-v1
379 > http://bad.entry3 BUNDLESPEC=none-v100
380 > http://localhost:$HGPORT1/full.hg BUNDLESPEC=gzip-v2
381 > EOF
382
383 $ hg debug::clonebundle-manifest http://localhost:$HGPORT --raw
384 http://bad.entry1 BUNDLESPEC=UNKNOWN
385 http://bad.entry2 BUNDLESPEC=xz-v1
386 http://bad.entry3 BUNDLESPEC=none-v100
387 http://localhost:$HGPORT1/full.hg BUNDLESPEC=gzip-v2
388 $ hg debug::clonebundle-manifest http://localhost:$HGPORT
389 URL: http://localhost:$HGPORT1/full.hg
390 BUNDLESPEC: gzip-v2
391 COMPRESSION: gzip
392 VERSION: v2
393 $ hg clone -U http://localhost:$HGPORT filter-unknown-type
394 applying clone bundle from http://localhost:$HGPORT1/full.hg
395 adding changesets
396 adding manifests
397 adding file changes
398 added 2 changesets with 2 changes to 2 files
399 finished applying clone bundle
400 searching for changes
401 no changes found
402 2 local changesets published
403
404 Automatic fallback when all entries are filtered
405
406 $ cat > server/.hg/clonebundles.manifest << EOF
407 > http://bad.entry BUNDLESPEC=UNKNOWN
408 > EOF
409
410 $ hg debug::clonebundle-manifest http://localhost:$HGPORT --raw
411 http://bad.entry BUNDLESPEC=UNKNOWN
412 $ hg debug::clonebundle-manifest http://localhost:$HGPORT
413 $ hg clone -U http://localhost:$HGPORT filter-all
414 no compatible clone bundles available on server; falling back to regular clone
415 (you may want to report this to the server operator)
416 requesting all changes
417 adding changesets
418 adding manifests
419 adding file changes
420 added 2 changesets with 2 changes to 2 files
421 new changesets 53245c60e682:aaff8d2ffbbf
422
423 We require a Python version that supports SNI. Therefore, URLs requiring SNI
424 are not filtered.
425
426 $ cp full.hg sni.hg
427 $ cat > server/.hg/clonebundles.manifest << EOF
428 > http://localhost:$HGPORT1/sni.hg REQUIRESNI=true
429 > http://localhost:$HGPORT1/full.hg
430 > EOF
431
432 $ hg debug::clonebundle-manifest http://localhost:$HGPORT --raw
433 http://localhost:$HGPORT1/sni.hg REQUIRESNI=true
434 http://localhost:$HGPORT1/full.hg
435 $ hg debug::clonebundle-manifest http://localhost:$HGPORT
436 URL: http://localhost:$HGPORT1/sni.hg
437 REQUIRESNI: true
438 URL: http://localhost:$HGPORT1/full.hg
439 $ hg clone -U http://localhost:$HGPORT sni-supported
440 applying clone bundle from http://localhost:$HGPORT1/sni.hg
441 adding changesets
442 adding manifests
443 adding file changes
444 added 2 changesets with 2 changes to 2 files
445 finished applying clone bundle
446 searching for changes
447 no changes found
448 2 local changesets published
449
450 Stream clone bundles are supported
451
452 $ hg -R server debugcreatestreamclonebundle packed.hg
453 writing 613 bytes for 5 files (no-rust !)
454 writing 739 bytes for 7 files (rust !)
455 bundle requirements: generaldelta, revlogv1, sparserevlog (no-rust no-zstd !)
456 bundle requirements: generaldelta, revlog-compression-zstd, revlogv1, sparserevlog (no-rust zstd !)
457 bundle requirements: generaldelta, revlog-compression-zstd, revlogv1, sparserevlog (rust !)
458
459 No bundle spec should work
460
461 $ cat > server/.hg/clonebundles.manifest << EOF
462 > http://localhost:$HGPORT1/packed.hg
463 > EOF
464
465 $ hg debug::clonebundle-manifest http://localhost:$HGPORT --raw
466 http://localhost:$HGPORT1/packed.hg
467 $ hg debug::clonebundle-manifest http://localhost:$HGPORT
468 URL: http://localhost:$HGPORT1/packed.hg
469 $ hg clone -U http://localhost:$HGPORT stream-clone-no-spec
470 applying clone bundle from http://localhost:$HGPORT1/packed.hg
471 * files to transfer, * bytes of data (glob)
472 stream-cloned * files / * bytes in * seconds (* */sec) (glob)
473 finished applying clone bundle
474 searching for changes
475 no changes found
476
477 Bundle spec without parameters should work
478
479 $ cat > server/.hg/clonebundles.manifest << EOF
480 > http://localhost:$HGPORT1/packed.hg BUNDLESPEC=none-packed1
481 > EOF
482
483 $ hg debug::clonebundle-manifest http://localhost:$HGPORT --raw
484 http://localhost:$HGPORT1/packed.hg BUNDLESPEC=none-packed1
485 $ hg debug::clonebundle-manifest http://localhost:$HGPORT
486 URL: http://localhost:$HGPORT1/packed.hg
487 BUNDLESPEC: none-packed1
488 COMPRESSION: none
489 VERSION: packed1
490 $ hg clone -U http://localhost:$HGPORT stream-clone-vanilla-spec
491 applying clone bundle from http://localhost:$HGPORT1/packed.hg
492 * files to transfer, * bytes of data (glob)
493 stream-cloned * files / * bytes in * seconds (* */sec) (glob)
494 finished applying clone bundle
495 searching for changes
496 no changes found
497
498 Bundle spec with format requirements should work
499
500 $ cat > server/.hg/clonebundles.manifest << EOF
501 > http://localhost:$HGPORT1/packed.hg BUNDLESPEC=none-packed1;requirements%3Drevlogv1
502 > EOF
503
504 $ hg debug::clonebundle-manifest http://localhost:$HGPORT --raw
505 http://localhost:$HGPORT1/packed.hg BUNDLESPEC=none-packed1;requirements%3Drevlogv1
506 $ hg debug::clonebundle-manifest http://localhost:$HGPORT
507 URL: http://localhost:$HGPORT1/packed.hg
508 BUNDLESPEC: none-packed1;requirements=revlogv1
509 COMPRESSION: none
510 VERSION: packed1
511 $ hg clone -U http://localhost:$HGPORT stream-clone-supported-requirements
512 applying clone bundle from http://localhost:$HGPORT1/packed.hg
513 * files to transfer, * bytes of data (glob)
514 stream-cloned * files / * bytes in * seconds (* */sec) (glob)
515 finished applying clone bundle
516 searching for changes
517 no changes found
518
519 Stream bundle spec with unknown requirements should be filtered out
520
521 $ cat > server/.hg/clonebundles.manifest << EOF
522 > http://localhost:$HGPORT1/packed.hg BUNDLESPEC=none-packed1;requirements%3Drevlogv42
523 > EOF
524
525 $ hg debug::clonebundle-manifest http://localhost:$HGPORT --raw
526 http://localhost:$HGPORT1/packed.hg BUNDLESPEC=none-packed1;requirements%3Drevlogv42
527 $ hg debug::clonebundle-manifest http://localhost:$HGPORT
528 $ hg clone -U http://localhost:$HGPORT stream-clone-unsupported-requirements
529 no compatible clone bundles available on server; falling back to regular clone
530 (you may want to report this to the server operator)
531 requesting all changes
532 adding changesets
533 adding manifests
534 adding file changes
535 added 2 changesets with 2 changes to 2 files
536 new changesets 53245c60e682:aaff8d2ffbbf
537
538
539 Filtering unsupported delta-compression away
540
541 $ cat > server/.hg/clonebundles.manifest << EOF
542 > http://no-comp.entry BUNDLESPEC=none-v2;cg.version=04
543 > http://non-comp.entry BUNDLESPEC=none-v2;cg.version=04;delta-compression=none
544 > http://zlib-comp.entry BUNDLESPEC=none-v2;cg.version=04;delta-compression=none,zlib
545 > http://zstd-comp.entry BUNDLESPEC=none-v2;cg.version=04;delta-compression=none,zlib,zstd
546 > http://unknown-comp.entry BUNDLESPEC=none-v2;cg.version=04;delta-compression=none,zlib,zstd,babar
547 > EOF
548 $ hg debug::clonebundle-manifest http://localhost:$HGPORT --raw
549 http://no-comp.entry BUNDLESPEC=none-v2;cg.version=04
550 http://non-comp.entry BUNDLESPEC=none-v2;cg.version=04;delta-compression=none
551 http://zlib-comp.entry BUNDLESPEC=none-v2;cg.version=04;delta-compression=none,zlib
552 http://zstd-comp.entry BUNDLESPEC=none-v2;cg.version=04;delta-compression=none,zlib,zstd
553 http://unknown-comp.entry BUNDLESPEC=none-v2;cg.version=04;delta-compression=none,zlib,zstd,babar
554 $ hg debug::clonebundle-manifest http://localhost:$HGPORT
555 URL: http://no-comp.entry
556 BUNDLESPEC: none-v2;cg.version=04
557 COMPRESSION: none
558 VERSION: v2
559 URL: http://non-comp.entry
560 BUNDLESPEC: none-v2;cg.version=04;delta-compression=none
561 COMPRESSION: none
562 DELTA-COMPRESSION: none
563 VERSION: v2
564 URL: http://zlib-comp.entry
565 BUNDLESPEC: none-v2;cg.version=04;delta-compression=none,zlib
566 COMPRESSION: none
567 DELTA-COMPRESSION: none,zlib
568 VERSION: v2
569 URL: http://zstd-comp.entry (zstd !)
570 BUNDLESPEC: none-v2;cg.version=04;delta-compression=none,zlib,zstd (zstd !)
571 COMPRESSION: none (zstd !)
572 DELTA-COMPRESSION: none,zlib,zstd (zstd !)
573 VERSION: v2 (zstd !)
574
575 Testing preferences configuration
576 ---------------------------------
577
578 Set up manifest for testing preferences
579 (Remember, the TYPE does not have to match reality - the URL is
580 important)
581
582 $ cp full.hg gz-a.hg
583 $ cp full.hg gz-b.hg
584 $ cp full.hg bz2-a.hg
585 $ cp full.hg bz2-b.hg
586 $ cat > server/.hg/clonebundles.manifest << EOF
587 > http://localhost:$HGPORT1/gz-a.hg BUNDLESPEC=gzip-v2 extra=a
588 > http://localhost:$HGPORT1/bz2-a.hg BUNDLESPEC=bzip2-v2 extra=a
589 > http://localhost:$HGPORT1/gz-b.hg BUNDLESPEC=gzip-v2 extra=b
590 > http://localhost:$HGPORT1/bz2-b.hg BUNDLESPEC=bzip2-v2 extra=b
591 > EOF
592
593 Preferring an undefined attribute will take first entry
594
595 $ hg --config ui.clonebundleprefers=foo=bar clone -U http://localhost:$HGPORT prefer-foo
596 applying clone bundle from http://localhost:$HGPORT1/gz-a.hg
597 adding changesets
598 adding manifests
599 adding file changes
600 added 2 changesets with 2 changes to 2 files
601 finished applying clone bundle
602 searching for changes
603 no changes found
604 2 local changesets published
605
606 Preferring bz2 type will download first entry of that type
607
608 $ hg --config ui.clonebundleprefers=COMPRESSION=bzip2 clone -U http://localhost:$HGPORT prefer-bz
609 applying clone bundle from http://localhost:$HGPORT1/bz2-a.hg
610 adding changesets
611 adding manifests
612 adding file changes
613 added 2 changesets with 2 changes to 2 files
614 finished applying clone bundle
615 searching for changes
616 no changes found
617 2 local changesets published
618
619 Preferring multiple values of an option works
620
621 $ hg --config ui.clonebundleprefers=COMPRESSION=unknown,COMPRESSION=bzip2 clone -U http://localhost:$HGPORT prefer-multiple-bz
622 applying clone bundle from http://localhost:$HGPORT1/bz2-a.hg
623 adding changesets
624 adding manifests
625 adding file changes
626 added 2 changesets with 2 changes to 2 files
627 finished applying clone bundle
628 searching for changes
629 no changes found
630 2 local changesets published
631
632 Sorting multiple values should get us back to original first entry
633
634 $ hg --config ui.clonebundleprefers=BUNDLESPEC=unknown,BUNDLESPEC=gzip-v2,BUNDLESPEC=bzip2-v2 clone -U http://localhost:$HGPORT prefer-multiple-gz
635 applying clone bundle from http://localhost:$HGPORT1/gz-a.hg
636 adding changesets
637 adding manifests
638 adding file changes
639 added 2 changesets with 2 changes to 2 files
640 finished applying clone bundle
641 searching for changes
642 no changes found
643 2 local changesets published
644
645 Preferring multiple attributes has correct order
646
647 $ hg --config ui.clonebundleprefers=extra=b,BUNDLESPEC=bzip2-v2 clone -U http://localhost:$HGPORT prefer-separate-attributes
648 applying clone bundle from http://localhost:$HGPORT1/bz2-b.hg
649 adding changesets
650 adding manifests
651 adding file changes
652 added 2 changesets with 2 changes to 2 files
653 finished applying clone bundle
654 searching for changes
655 no changes found
656 2 local changesets published
657
658 Test where attribute is missing from some entries
659
660 $ cat > server/.hg/clonebundles.manifest << EOF
661 > http://localhost:$HGPORT1/gz-a.hg BUNDLESPEC=gzip-v2
662 > http://localhost:$HGPORT1/bz2-a.hg BUNDLESPEC=bzip2-v2
663 > http://localhost:$HGPORT1/gz-b.hg BUNDLESPEC=gzip-v2 extra=b
664 > http://localhost:$HGPORT1/bz2-b.hg BUNDLESPEC=bzip2-v2 extra=b
665 > EOF
666
667 $ hg debug::clonebundle-manifest http://localhost:$HGPORT --raw
668 http://localhost:$HGPORT1/gz-a.hg BUNDLESPEC=gzip-v2
669 http://localhost:$HGPORT1/bz2-a.hg BUNDLESPEC=bzip2-v2
670 http://localhost:$HGPORT1/gz-b.hg BUNDLESPEC=gzip-v2 extra=b
671 http://localhost:$HGPORT1/bz2-b.hg BUNDLESPEC=bzip2-v2 extra=b
672 $ hg debug::clonebundle-manifest http://localhost:$HGPORT
673 URL: http://localhost:$HGPORT1/gz-a.hg
674 BUNDLESPEC: gzip-v2
675 COMPRESSION: gzip
676 VERSION: v2
677 URL: http://localhost:$HGPORT1/bz2-a.hg
678 BUNDLESPEC: bzip2-v2
679 COMPRESSION: bzip2
680 VERSION: v2
681 URL: http://localhost:$HGPORT1/gz-b.hg
682 BUNDLESPEC: gzip-v2
683 COMPRESSION: gzip
684 VERSION: v2
685 extra: b
686 URL: http://localhost:$HGPORT1/bz2-b.hg
687 BUNDLESPEC: bzip2-v2
688 COMPRESSION: bzip2
689 VERSION: v2
690 extra: b
691 $ hg --config ui.clonebundleprefers=extra=b clone -U http://localhost:$HGPORT prefer-partially-defined-attribute
692 applying clone bundle from http://localhost:$HGPORT1/gz-b.hg
693 adding changesets
694 adding manifests
695 adding file changes
696 added 2 changesets with 2 changes to 2 files
697 finished applying clone bundle
698 searching for changes
699 no changes found
700 2 local changesets published
701
702 Test a bad attribute list
703
704 $ hg --config ui.clonebundleprefers=bad clone -U http://localhost:$HGPORT bad-input
705 abort: invalid ui.clonebundleprefers item: bad
706 (each comma separated item should be key=value pairs)
707 [255]
708 $ hg --config ui.clonebundleprefers=key=val,bad,key2=val2 clone \
709 > -U http://localhost:$HGPORT bad-input
710 abort: invalid ui.clonebundleprefers item: bad
711 (each comma separated item should be key=value pairs)
712 [255]
713
714
715 Test interaction between clone bundles and --stream
716
717 A manifest with just a gzip bundle
718
719 $ cat > server/.hg/clonebundles.manifest << EOF
720 > http://localhost:$HGPORT1/gz-a.hg BUNDLESPEC=gzip-v2
721 > EOF
722
723 $ hg debug::clonebundle-manifest http://localhost:$HGPORT --raw
724 http://localhost:$HGPORT1/gz-a.hg BUNDLESPEC=gzip-v2
725 $ hg debug::clonebundle-manifest http://localhost:$HGPORT
726 URL: http://localhost:$HGPORT1/gz-a.hg
727 BUNDLESPEC: gzip-v2
728 COMPRESSION: gzip
729 VERSION: v2
730 $ hg debug::clonebundle-manifest http://localhost:$HGPORT --raw
731 http://localhost:$HGPORT1/gz-a.hg BUNDLESPEC=gzip-v2
732 $ hg debug::clonebundle-manifest http://localhost:$HGPORT
733 URL: http://localhost:$HGPORT1/gz-a.hg
734 BUNDLESPEC: gzip-v2
735 COMPRESSION: gzip
736 VERSION: v2
737 $ hg clone -U --stream http://localhost:$HGPORT uncompressed-gzip
738 no compatible clone bundles available on server; falling back to regular clone
739 (you may want to report this to the server operator)
740 streaming all changes
741 * files to transfer, * bytes of data (glob)
742 stream-cloned * files / * bytes in * seconds (* */sec) (glob)
743
744 A manifest with a stream clone but no BUNDLESPEC
745
746 $ cat > server/.hg/clonebundles.manifest << EOF
747 > http://localhost:$HGPORT1/packed.hg
748 > EOF
749
750 $ hg debug::clonebundle-manifest http://localhost:$HGPORT --raw
751 http://localhost:$HGPORT1/packed.hg
752 $ hg debug::clonebundle-manifest http://localhost:$HGPORT
753 URL: http://localhost:$HGPORT1/packed.hg
754 $ hg clone -U --stream http://localhost:$HGPORT uncompressed-no-bundlespec
755 no compatible clone bundles available on server; falling back to regular clone
756 (you may want to report this to the server operator)
757 streaming all changes
758 * files to transfer, * bytes of data (glob)
759 stream-cloned * files / * bytes in * seconds (* */sec) (glob)
760
761 A manifest with a gzip bundle and a stream clone
762
763 $ cat > server/.hg/clonebundles.manifest << EOF
764 > http://localhost:$HGPORT1/gz-a.hg BUNDLESPEC=gzip-v2
765 > http://localhost:$HGPORT1/packed.hg BUNDLESPEC=none-packed1
766 > EOF
767
768 $ hg debug::clonebundle-manifest http://localhost:$HGPORT --raw
769 http://localhost:$HGPORT1/gz-a.hg BUNDLESPEC=gzip-v2
770 http://localhost:$HGPORT1/packed.hg BUNDLESPEC=none-packed1
771 $ hg debug::clonebundle-manifest http://localhost:$HGPORT
772 URL: http://localhost:$HGPORT1/gz-a.hg
773 BUNDLESPEC: gzip-v2
774 COMPRESSION: gzip
775 VERSION: v2
776 URL: http://localhost:$HGPORT1/packed.hg
777 BUNDLESPEC: none-packed1
778 COMPRESSION: none
779 VERSION: packed1
780 $ hg clone -U --stream http://localhost:$HGPORT uncompressed-gzip-packed
781 applying clone bundle from http://localhost:$HGPORT1/packed.hg
782 * files to transfer, * bytes of data (glob)
783 stream-cloned * files / * bytes in * seconds (* */sec) (glob)
784 finished applying clone bundle
785 searching for changes
786 no changes found
787
788 A manifest with a gzip bundle and stream clone with supported requirements
789
790 $ cat > server/.hg/clonebundles.manifest << EOF
791 > http://localhost:$HGPORT1/gz-a.hg BUNDLESPEC=gzip-v2
792 > http://localhost:$HGPORT1/packed.hg BUNDLESPEC=none-packed1;requirements%3Drevlogv1
793 > EOF
794
795 $ hg debug::clonebundle-manifest http://localhost:$HGPORT --raw
796 http://localhost:$HGPORT1/gz-a.hg BUNDLESPEC=gzip-v2
797 http://localhost:$HGPORT1/packed.hg BUNDLESPEC=none-packed1;requirements%3Drevlogv1
798 $ hg debug::clonebundle-manifest http://localhost:$HGPORT
799 URL: http://localhost:$HGPORT1/gz-a.hg
800 BUNDLESPEC: gzip-v2
801 COMPRESSION: gzip
802 VERSION: v2
803 URL: http://localhost:$HGPORT1/packed.hg
804 BUNDLESPEC: none-packed1;requirements=revlogv1
805 COMPRESSION: none
806 VERSION: packed1
807 $ hg clone -U --stream http://localhost:$HGPORT uncompressed-gzip-packed-requirements
808 applying clone bundle from http://localhost:$HGPORT1/packed.hg
809 * files to transfer, * bytes of data (glob)
810 stream-cloned * files / * bytes in * seconds (* */sec) (glob)
811 finished applying clone bundle
812 searching for changes
813 no changes found
814
815 A manifest with a gzip bundle and a stream clone with unsupported requirements
816
817 $ cat > server/.hg/clonebundles.manifest << EOF
818 > http://localhost:$HGPORT1/gz-a.hg BUNDLESPEC=gzip-v2
819 > http://localhost:$HGPORT1/packed.hg BUNDLESPEC=none-packed1;requirements%3Drevlogv42
820 > EOF
821
822 $ hg debug::clonebundle-manifest http://localhost:$HGPORT --raw
823 http://localhost:$HGPORT1/gz-a.hg BUNDLESPEC=gzip-v2
824 http://localhost:$HGPORT1/packed.hg BUNDLESPEC=none-packed1;requirements%3Drevlogv42
825 $ hg debug::clonebundle-manifest http://localhost:$HGPORT
826 URL: http://localhost:$HGPORT1/gz-a.hg
827 BUNDLESPEC: gzip-v2
828 COMPRESSION: gzip
829 VERSION: v2
830 $ hg clone -U --stream http://localhost:$HGPORT uncompressed-gzip-packed-unsupported-requirements
831 no compatible clone bundles available on server; falling back to regular clone
832 (you may want to report this to the server operator)
833 streaming all changes
834 * files to transfer, * bytes of data (glob)
835 stream-cloned * files / * bytes in * seconds (* */sec) (glob)
836
837 Test clone bundle retrieved through bundle2
838
839 $ cat << EOF >> $HGRCPATH
840 > [extensions]
841 > largefiles=
842 > EOF
843 $ killdaemons.py
844 $ hg -R server serve -d -p $HGPORT --pid-file hg.pid --accesslog access.log
845 $ cat hg.pid >> $DAEMON_PIDS
846
847 $ hg -R server debuglfput gz-a.hg
848 1f74b3d08286b9b3a16fb3fa185dd29219cbc6ae
849
850 $ cat > server/.hg/clonebundles.manifest << EOF
851 > largefile://1f74b3d08286b9b3a16fb3fa185dd29219cbc6ae BUNDLESPEC=gzip-v2
852 > EOF
853
854 $ hg debug::clonebundle-manifest http://localhost:$HGPORT
855 URL: largefile://1f74b3d08286b9b3a16fb3fa185dd29219cbc6ae
856 BUNDLESPEC: gzip-v2
857 COMPRESSION: gzip
858 VERSION: v2
859 $ hg debug::clonebundle-manifest http://localhost:$HGPORT --raw
860 largefile://1f74b3d08286b9b3a16fb3fa185dd29219cbc6ae BUNDLESPEC=gzip-v2
861 $ hg clone -U http://localhost:$HGPORT largefile-provided --traceback
862 applying clone bundle from largefile://1f74b3d08286b9b3a16fb3fa185dd29219cbc6ae
863 adding changesets
864 adding manifests
865 adding file changes
866 added 2 changesets with 2 changes to 2 files
867 finished applying clone bundle
868 searching for changes
869 no changes found
870 2 local changesets published
871 $ killdaemons.py
872
873 A manifest with a gzip bundle requiring too much memory for a 16MB system and working
874 on a 32MB system.
875
876 $ "$PYTHON" $TESTDIR/dumbhttp.py -p $HGPORT1 --pid http.pid
877 $ cat http.pid >> $DAEMON_PIDS
878 $ hg -R server serve -d -p $HGPORT --pid-file hg.pid --accesslog access.log
879 $ cat hg.pid >> $DAEMON_PIDS
880
881 $ cat > server/.hg/clonebundles.manifest << EOF
882 > http://localhost:$HGPORT1/gz-a.hg BUNDLESPEC=gzip-v2 REQUIREDRAM=12MB
883 > EOF
884
885 $ hg debug::clonebundle-manifest http://localhost:$HGPORT --raw
886 http://localhost:$HGPORT1/gz-a.hg BUNDLESPEC=gzip-v2 REQUIREDRAM=12MB
887 $ hg debug::clonebundle-manifest http://localhost:$HGPORT
888 URL: http://localhost:$HGPORT1/gz-a.hg
889 BUNDLESPEC: gzip-v2
890 COMPRESSION: gzip
891 VERSION: v2
892 REQUIREDRAM: 12MB
893 $ hg clone -U --debug --config ui.available-memory=16MB http://localhost:$HGPORT gzip-too-large
894 using http://localhost:$HGPORT/
895 sending capabilities command
896 sending clonebundles_manifest command
897 filtering http://localhost:$HGPORT1/gz-a.hg as it needs more than 2/3 of system memory
898 no compatible clone bundles available on server; falling back to regular clone
899 (you may want to report this to the server operator)
900 query 1; heads
901 sending batch command
902 requesting all changes
903 sending getbundle command
904 bundle2-input-bundle: with-transaction
905 bundle2-input-part: "changegroup" (params: 1 mandatory 1 advisory) supported
906 adding changesets
907 add changeset 53245c60e682
908 add changeset aaff8d2ffbbf
909 adding manifests
910 adding file changes
911 adding bar revisions
912 adding foo revisions
913 bundle2-input-part: total payload size 936
914 bundle2-input-part: "listkeys" (params: 1 mandatory) supported
915 bundle2-input-part: "phase-heads" supported
916 bundle2-input-part: total payload size 24
917 bundle2-input-bundle: 3 parts total
918 checking for updated bookmarks
919 updating the branch cache
920 added 2 changesets with 2 changes to 2 files
921 new changesets 53245c60e682:aaff8d2ffbbf
922 calling hook changegroup.lfiles: hgext.largefiles.reposetup.checkrequireslfiles
923 updating the branch cache
924 (sent 4 HTTP requests and * bytes; received * bytes in responses) (glob)
925
926 $ hg clone -U --debug --config ui.available-memory=32MB http://localhost:$HGPORT gzip-too-large2
927 using http://localhost:$HGPORT/
928 sending capabilities command
929 sending clonebundles_manifest command
930 applying clone bundle from http://localhost:$HGPORT1/gz-a.hg
931 bundle2-input-bundle: 1 params with-transaction
932 bundle2-input-part: "changegroup" (params: 1 mandatory 1 advisory) supported
933 adding changesets
934 add changeset 53245c60e682
935 add changeset aaff8d2ffbbf
936 adding manifests
937 adding file changes
938 adding bar revisions
939 adding foo revisions
940 bundle2-input-part: total payload size 920
941 bundle2-input-part: "cache:rev-branch-cache" (advisory) supported
942 bundle2-input-part: total payload size 59
943 bundle2-input-bundle: 2 parts total
944 updating the branch cache
945 added 2 changesets with 2 changes to 2 files
946 finished applying clone bundle
947 query 1; heads
948 sending batch command
949 searching for changes
950 all remote heads known locally
951 no changes found
952 sending getbundle command
953 bundle2-input-bundle: with-transaction
954 bundle2-input-part: "listkeys" (params: 1 mandatory) supported
955 bundle2-input-part: "phase-heads" supported
956 bundle2-input-part: total payload size 24
957 bundle2-input-bundle: 2 parts total
958 checking for updated bookmarks
959 2 local changesets published
960 calling hook changegroup.lfiles: hgext.largefiles.reposetup.checkrequireslfiles
961 updating the branch cache
962 (sent 4 HTTP requests and * bytes; received * bytes in responses) (glob)
963 $ killdaemons.py
964
965 Testing a clone bundle with digest
966 ==================================
967
968 $ "$PYTHON" $TESTDIR/dumbhttp.py -p $HGPORT1 --pid http.pid
969 $ cat http.pid >> $DAEMON_PIDS
970 $ hg -R server serve -d -p $HGPORT --pid-file hg.pid --accesslog access.log
971 $ cat hg.pid >> $DAEMON_PIDS
972
973 $ digest=$("$PYTHON" -c "import hashlib; print (hashlib.sha256(open('gz-a.hg', 'rb').read()).hexdigest())")
974 $ cat > server/.hg/clonebundles.manifest << EOF
975 > http://localhost:$HGPORT1/gz-a.hg BUNDLESPEC=gzip-v2 DIGEST=sha256:${digest}
976 > EOF
977 $ hg debug::clonebundle-manifest http://localhost:$HGPORT --raw
978 http://localhost:$HGPORT1/gz-a.hg BUNDLESPEC=gzip-v2 DIGEST=sha256:5f9eac7db9900194be019b465352bcd65982ac6ac4b45edda0a77de7c98f20b9
979 $ hg debug::clonebundle-manifest http://localhost:$HGPORT
980 URL: http://localhost:$HGPORT1/gz-a.hg
981 BUNDLESPEC: gzip-v2
982 COMPRESSION: gzip
983 VERSION: v2
984 DIGEST: sha256:5f9eac7db9900194be019b465352bcd65982ac6ac4b45edda0a77de7c98f20b9
985 $ hg clone -U http://localhost:$HGPORT digest-valid
986 applying clone bundle from http://localhost:$HGPORT1/gz-a.hg
987 adding changesets
988 adding manifests
989 adding file changes
990 added 2 changesets with 2 changes to 2 files
991 finished applying clone bundle
992 searching for changes
993 no changes found
994 2 local changesets published
995 $ digest_bad=$("$PYTHON" -c "import hashlib; print (hashlib.sha256(open('gz-a.hg', 'rb').read()+b'.').hexdigest())")
996 $ cat > server/.hg/clonebundles.manifest << EOF
997 > http://localhost:$HGPORT1/gz-a.hg BUNDLESPEC=gzip-v2 DIGEST=sha256:${digest_bad}
998 > EOF
999 $ hg debug::clonebundle-manifest http://localhost:$HGPORT --raw
1000 http://localhost:$HGPORT1/gz-a.hg BUNDLESPEC=gzip-v2 DIGEST=sha256:9cb4468a7a50dfe8a9c411a86776c117018681b53876ca6e0c283614ca6debc8
1001 $ hg debug::clonebundle-manifest http://localhost:$HGPORT
1002 URL: http://localhost:$HGPORT1/gz-a.hg
1003 BUNDLESPEC: gzip-v2
1004 COMPRESSION: gzip
1005 VERSION: v2
1006 DIGEST: sha256:9cb4468a7a50dfe8a9c411a86776c117018681b53876ca6e0c283614ca6debc8
1007 $ hg clone -U http://localhost:$HGPORT digest-invalid
1008 applying clone bundle from http://localhost:$HGPORT1/gz-a.hg
1009 abort: file with digest [0-9a-f]* expected, but [0-9a-f]* found for [0-9]* bytes (re)
1010 [150]
1011 $ cat > server/.hg/clonebundles.manifest << EOF
1012 > http://localhost:$HGPORT1/bad-a.hg BUNDLESPEC=gzip-v2 DIGEST=sha256:xx
1013 > http://localhost:$HGPORT1/bad-b.hg BUNDLESPEC=gzip-v2 DIGEST=xxx:0000
1014 > http://localhost:$HGPORT1/bad-c.hg BUNDLESPEC=gzip-v2 DIGEST=sha256:0000
1015 > http://localhost:$HGPORT1/bad-d.hg BUNDLESPEC=gzip-v2 DIGEST=xxx:00,xxx:01
1016 > http://localhost:$HGPORT1/gz-a.hg BUNDLESPEC=gzip-v2 DIGEST=sha256:${digest_bad}
1017 > EOF
1018 $ hg debug::clonebundle-manifest http://localhost:$HGPORT --raw
1019 http://localhost:$HGPORT1/bad-a.hg BUNDLESPEC=gzip-v2 DIGEST=sha256:xx
1020 http://localhost:$HGPORT1/bad-b.hg BUNDLESPEC=gzip-v2 DIGEST=xxx:0000
1021 http://localhost:$HGPORT1/bad-c.hg BUNDLESPEC=gzip-v2 DIGEST=sha256:0000
1022 http://localhost:$HGPORT1/bad-d.hg BUNDLESPEC=gzip-v2 DIGEST=xxx:00,xxx:01
1023 http://localhost:$HGPORT1/gz-a.hg BUNDLESPEC=gzip-v2 DIGEST=sha256:9cb4468a7a50dfe8a9c411a86776c117018681b53876ca6e0c283614ca6debc8
1024 $ hg debug::clonebundle-manifest http://localhost:$HGPORT
1025 URL: http://localhost:$HGPORT1/gz-a.hg
1026 BUNDLESPEC: gzip-v2
1027 COMPRESSION: gzip
1028 VERSION: v2
1029 DIGEST: sha256:9cb4468a7a50dfe8a9c411a86776c117018681b53876ca6e0c283614ca6debc8
1030 $ hg clone --debug -U http://localhost:$HGPORT digest-malformed
1031 using http://localhost:$HGPORT/
1032 sending capabilities command
1033 sending clonebundles_manifest command
1034 filtering http://localhost:$HGPORT1/bad-a.hg due to a bad DIGEST attribute
1035 filtering http://localhost:$HGPORT1/bad-b.hg due to lack of supported digest
1036 filtering http://localhost:$HGPORT1/bad-c.hg due to a bad sha256 digest
1037 filtering http://localhost:$HGPORT1/bad-d.hg due to conflicting xxx digests
1038 applying clone bundle from http://localhost:$HGPORT1/gz-a.hg
1039 bundle2-input-bundle: 1 params with-transaction
1040 bundle2-input-bundle: 0 parts total
1041 \(sent [0-9]* HTTP requests and [0-9]* bytes; received [0-9]* bytes in responses\) (re)
1042 abort: file with digest [0-9a-f]* expected, but [0-9a-f]* found for [0-9]* bytes (re)
1043 [150]
1044 $ cat > server/.hg/clonebundles.manifest << EOF
1045 > http://localhost:$HGPORT1/gz-a.hg BUNDLESPEC=gzip-v2 DIGEST=sha512:00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,sha256:0000000000000000000000000000000000000000000000000000000000000000
1046 > EOF
1047 $ hg debug::clonebundle-manifest http://localhost:$HGPORT --raw
1048 http://localhost:$HGPORT1/gz-a.hg BUNDLESPEC=gzip-v2 DIGEST=sha512:00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,sha256:0000000000000000000000000000000000000000000000000000000000000000
1049 $ hg debug::clonebundle-manifest http://localhost:$HGPORT
1050 URL: http://localhost:$HGPORT1/gz-a.hg
1051 BUNDLESPEC: gzip-v2
1052 COMPRESSION: gzip
1053 VERSION: v2
1054 DIGEST: sha512:00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,sha256:0000000000000000000000000000000000000000000000000000000000000000
1055 $ hg clone -U http://localhost:$HGPORT digest-preference
1056 applying clone bundle from http://localhost:$HGPORT1/gz-a.hg
1057 abort: file with digest 0{64} expected, but [0-9a-f]+ found for [0-9]+ bytes (re)
1058 [150]
1059 $ killdaemons.py
1060
1061 Testing a clone bundles that involves revlog splitting (issue6811)
1062 ==================================================================
1063
1064 $ cat >> $HGRCPATH << EOF
1065 > [format]
1066 > revlog-compression=none
1067 > use-persistent-nodemap=no
1068 > EOF
1069
1070 $ hg init server-revlog-split/
1071 $ cd server-revlog-split
1072 $ cat >> .hg/hgrc << EOF
1073 > [extensions]
1074 > clonebundles =
1075 > EOF
1076 $ echo foo > A
1077 $ hg add A
1078 $ hg commit -m 'initial commit'
1079 IMPORTANT: the revlogs must not be split
1080 $ ls -1 .hg/store/00manifest.*
1081 .hg/store/00manifest.i
1082 $ ls -1 .hg/store/data/_a.*
1083 .hg/store/data/_a.i
1084
1085 do big enough update to split the revlogs
1086
1087 $ $TESTDIR/seq.py 100000 > A
1088 $ mkdir foo
1089 $ cd foo
1090 $ touch `$TESTDIR/seq.py 10000`
1091 $ cd ..
1092 $ hg add -q foo
1093 $ hg commit -m 'split the manifest and one filelog'
1094
1095 IMPORTANT: now the revlogs must be split
1096 $ ls -1 .hg/store/00manifest.*
1097 .hg/store/00manifest.d
1098 .hg/store/00manifest.i
1099 $ ls -1 .hg/store/data/_a.*
1100 .hg/store/data/_a.d
1101 .hg/store/data/_a.i
1102
1103 Add an extra commit on top of that
1104
1105 $ echo foo >> A
1106 $ hg commit -m 'one extra commit'
1107
1108 $ cd ..
1109
1110 Do a bundle that contains the split, but not the update
1111
1112 $ hg bundle --exact --rev '::(default~1)' -R server-revlog-split/ --type gzip-v2 split-test.hg
1113 2 changesets found
1114
1115 $ cat > server-revlog-split/.hg/clonebundles.manifest << EOF
1116 > http://localhost:$HGPORT1/split-test.hg BUNDLESPEC=gzip-v2
1117 > EOF
1118
1119 start the necessary server
1120
1121 $ "$PYTHON" $TESTDIR/dumbhttp.py -p $HGPORT1 --pid http.pid
1122 $ cat http.pid >> $DAEMON_PIDS
1123 $ hg -R server-revlog-split serve -d -p $HGPORT --pid-file hg.pid --accesslog access.log
1124 $ cat hg.pid >> $DAEMON_PIDS
1125
1126 Check that clone works fine
1127 ===========================
1128
1129 Here, the initial clone will trigger a revlog split (which is a bit clowny it
1130 itself, but whatever). The split revlogs will see additionnal data added to
1131 them in the subsequent pull. This should not be a problem
1132
1133 $ hg clone http://localhost:$HGPORT revlog-split-in-the-bundle
1134 applying clone bundle from http://localhost:$HGPORT1/split-test.hg
1135 adding changesets
1136 adding manifests
1137 adding file changes
1138 added 2 changesets with 10002 changes to 10001 files
1139 finished applying clone bundle
1140 searching for changes
1141 adding changesets
1142 adding manifests
1143 adding file changes
1144 added 1 changesets with 1 changes to 1 files
1145 new changesets e3879eaa1db7
1146 2 local changesets published
1147 updating to branch default
1148 10001 files updated, 0 files merged, 0 files removed, 0 files unresolved
1149
1150 check the results
1151
1152 $ cd revlog-split-in-the-bundle
1153 $ f --size .hg/store/00manifest.*
1154 .hg/store/00manifest.d: size=499037
1155 .hg/store/00manifest.i: size=192
1156 $ f --size .hg/store/data/_a.*
1157 .hg/store/data/_a.d: size=588917
1158 .hg/store/data/_a.i: size=192
1159
1160 manifest should work
1161
1162 $ hg files -r tip | wc -l
1163 \s*10001 (re)
1164
1165 file content should work
1166
1167 $ hg cat -r tip A | wc -l
1168 \s*100001 (re)