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