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