##// END OF EJS Templates
test-clonebundles: simplify matching to be less flavor depends...
marmoute -
r52352:077d5a78 default
parent child Browse files
Show More
@@ -1,869 +1,855 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 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: (.* refused.*|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 293 $ echo "[hooks]" >> server/.hg/hgrc
294 294 $ echo "pretransmit-inline-clone-bundle=echo foo" >> server/.hg/hgrc
295 295 $ hg clone -U ssh://user@dummy/server ssh-inline-clone-hook
296 296 applying clone bundle from peer-bundle-cache://full.hg
297 297 remote: foo
298 298 adding changesets
299 299 adding manifests
300 300 adding file changes
301 301 added 2 changesets with 2 changes to 2 files
302 302 finished applying clone bundle
303 303 searching for changes
304 304 no changes found
305 305 2 local changesets published
306 306
307 307 Hooks can make an inline bundle fail
308 308
309 309 $ cp server/.hg/hgrc-beforeinlinehooks server/.hg/hgrc
310 310 $ echo "[hooks]" >> server/.hg/hgrc
311 311 $ echo "pretransmit-inline-clone-bundle=echo bar && false" >> server/.hg/hgrc
312 312 $ hg clone -U ssh://user@dummy/server ssh-inline-clone-hook-fail
313 313 applying clone bundle from peer-bundle-cache://full.hg
314 314 remote: bar
315 315 remote: abort: pretransmit-inline-clone-bundle hook exited with status 1
316 316 abort: stream ended unexpectedly (got 0 bytes, expected 1)
317 317 [255]
318 318 $ cp server/.hg/hgrc-beforeinlinehooks server/.hg/hgrc
319 319
320 320 Other tests
321 321 ===========
322 322
323 323 Entry with unknown BUNDLESPEC is filtered and not used
324 324
325 325 $ cat > server/.hg/clonebundles.manifest << EOF
326 326 > http://bad.entry1 BUNDLESPEC=UNKNOWN
327 327 > http://bad.entry2 BUNDLESPEC=xz-v1
328 328 > http://bad.entry3 BUNDLESPEC=none-v100
329 329 > http://localhost:$HGPORT1/full.hg BUNDLESPEC=gzip-v2
330 330 > EOF
331 331
332 332 $ hg clone -U http://localhost:$HGPORT filter-unknown-type
333 333 applying clone bundle from http://localhost:$HGPORT1/full.hg
334 334 adding changesets
335 335 adding manifests
336 336 adding file changes
337 337 added 2 changesets with 2 changes to 2 files
338 338 finished applying clone bundle
339 339 searching for changes
340 340 no changes found
341 341 2 local changesets published
342 342
343 343 Automatic fallback when all entries are filtered
344 344
345 345 $ cat > server/.hg/clonebundles.manifest << EOF
346 346 > http://bad.entry BUNDLESPEC=UNKNOWN
347 347 > EOF
348 348
349 349 $ hg clone -U http://localhost:$HGPORT filter-all
350 350 no compatible clone bundles available on server; falling back to regular clone
351 351 (you may want to report this to the server operator)
352 352 requesting all changes
353 353 adding changesets
354 354 adding manifests
355 355 adding file changes
356 356 added 2 changesets with 2 changes to 2 files
357 357 new changesets 53245c60e682:aaff8d2ffbbf
358 358
359 359 We require a Python version that supports SNI. Therefore, URLs requiring SNI
360 360 are not filtered.
361 361
362 362 $ cp full.hg sni.hg
363 363 $ cat > server/.hg/clonebundles.manifest << EOF
364 364 > http://localhost:$HGPORT1/sni.hg REQUIRESNI=true
365 365 > http://localhost:$HGPORT1/full.hg
366 366 > EOF
367 367
368 368 $ hg clone -U http://localhost:$HGPORT sni-supported
369 369 applying clone bundle from http://localhost:$HGPORT1/sni.hg
370 370 adding changesets
371 371 adding manifests
372 372 adding file changes
373 373 added 2 changesets with 2 changes to 2 files
374 374 finished applying clone bundle
375 375 searching for changes
376 376 no changes found
377 377 2 local changesets published
378 378
379 379 Stream clone bundles are supported
380 380
381 381 $ hg -R server debugcreatestreamclonebundle packed.hg
382 382 writing 613 bytes for 5 files (no-rust !)
383 383 writing 739 bytes for 7 files (rust !)
384 384 bundle requirements: generaldelta, revlogv1, sparserevlog (no-rust no-zstd !)
385 385 bundle requirements: generaldelta, revlog-compression-zstd, revlogv1, sparserevlog (no-rust zstd !)
386 386 bundle requirements: generaldelta, revlog-compression-zstd, revlogv1, sparserevlog (rust !)
387 387
388 388 No bundle spec should work
389 389
390 390 $ cat > server/.hg/clonebundles.manifest << EOF
391 391 > http://localhost:$HGPORT1/packed.hg
392 392 > EOF
393 393
394 394 $ hg clone -U http://localhost:$HGPORT stream-clone-no-spec
395 395 applying clone bundle from http://localhost:$HGPORT1/packed.hg
396 396 5 files to transfer, 613 bytes of data (no-rust !)
397 transferred 613 bytes in *.* seconds (*) (glob) (no-rust !)
397 transferred 613 bytes in * seconds (* */sec) (glob) (no-rust !)
398 398 7 files to transfer, 739 bytes of data (rust !)
399 transferred 739 bytes in *.* seconds (*) (glob) (rust !)
399 transferred 739 bytes in * seconds (* */sec) (glob) (rust !)
400 400 finished applying clone bundle
401 401 searching for changes
402 402 no changes found
403 403
404 404 Bundle spec without parameters should work
405 405
406 406 $ cat > server/.hg/clonebundles.manifest << EOF
407 407 > http://localhost:$HGPORT1/packed.hg BUNDLESPEC=none-packed1
408 408 > EOF
409 409
410 410 $ hg clone -U http://localhost:$HGPORT stream-clone-vanilla-spec
411 411 applying clone bundle from http://localhost:$HGPORT1/packed.hg
412 5 files to transfer, 613 bytes of data (no-rust !)
413 transferred 613 bytes in *.* seconds (*) (glob) (no-rust !)
414 7 files to transfer, 739 bytes of data (rust !)
415 transferred 739 bytes in *.* seconds (*) (glob) (rust !)
412 * files to transfer, * bytes of data (glob)
413 transferred * bytes in * seconds (* */sec) (glob)
416 414 finished applying clone bundle
417 415 searching for changes
418 416 no changes found
419 417
420 418 Bundle spec with format requirements should work
421 419
422 420 $ cat > server/.hg/clonebundles.manifest << EOF
423 421 > http://localhost:$HGPORT1/packed.hg BUNDLESPEC=none-packed1;requirements%3Drevlogv1
424 422 > EOF
425 423
426 424 $ hg clone -U http://localhost:$HGPORT stream-clone-supported-requirements
427 425 applying clone bundle from http://localhost:$HGPORT1/packed.hg
428 5 files to transfer, 613 bytes of data (no-rust !)
429 transferred 613 bytes in *.* seconds (*) (glob) (no-rust !)
430 7 files to transfer, 739 bytes of data (rust !)
431 transferred 739 bytes in *.* seconds (*) (glob) (rust !)
426 * files to transfer, * bytes of data (glob)
427 transferred * bytes in * seconds (* */sec) (glob)
432 428 finished applying clone bundle
433 429 searching for changes
434 430 no changes found
435 431
436 432 Stream bundle spec with unknown requirements should be filtered out
437 433
438 434 $ cat > server/.hg/clonebundles.manifest << EOF
439 435 > http://localhost:$HGPORT1/packed.hg BUNDLESPEC=none-packed1;requirements%3Drevlogv42
440 436 > EOF
441 437
442 438 $ hg clone -U http://localhost:$HGPORT stream-clone-unsupported-requirements
443 439 no compatible clone bundles available on server; falling back to regular clone
444 440 (you may want to report this to the server operator)
445 441 requesting all changes
446 442 adding changesets
447 443 adding manifests
448 444 adding file changes
449 445 added 2 changesets with 2 changes to 2 files
450 446 new changesets 53245c60e682:aaff8d2ffbbf
451 447
452 448 Set up manifest for testing preferences
453 449 (Remember, the TYPE does not have to match reality - the URL is
454 450 important)
455 451
456 452 $ cp full.hg gz-a.hg
457 453 $ cp full.hg gz-b.hg
458 454 $ cp full.hg bz2-a.hg
459 455 $ cp full.hg bz2-b.hg
460 456 $ cat > server/.hg/clonebundles.manifest << EOF
461 457 > http://localhost:$HGPORT1/gz-a.hg BUNDLESPEC=gzip-v2 extra=a
462 458 > http://localhost:$HGPORT1/bz2-a.hg BUNDLESPEC=bzip2-v2 extra=a
463 459 > http://localhost:$HGPORT1/gz-b.hg BUNDLESPEC=gzip-v2 extra=b
464 460 > http://localhost:$HGPORT1/bz2-b.hg BUNDLESPEC=bzip2-v2 extra=b
465 461 > EOF
466 462
467 463 Preferring an undefined attribute will take first entry
468 464
469 465 $ hg --config ui.clonebundleprefers=foo=bar clone -U http://localhost:$HGPORT prefer-foo
470 466 applying clone bundle from http://localhost:$HGPORT1/gz-a.hg
471 467 adding changesets
472 468 adding manifests
473 469 adding file changes
474 470 added 2 changesets with 2 changes to 2 files
475 471 finished applying clone bundle
476 472 searching for changes
477 473 no changes found
478 474 2 local changesets published
479 475
480 476 Preferring bz2 type will download first entry of that type
481 477
482 478 $ hg --config ui.clonebundleprefers=COMPRESSION=bzip2 clone -U http://localhost:$HGPORT prefer-bz
483 479 applying clone bundle from http://localhost:$HGPORT1/bz2-a.hg
484 480 adding changesets
485 481 adding manifests
486 482 adding file changes
487 483 added 2 changesets with 2 changes to 2 files
488 484 finished applying clone bundle
489 485 searching for changes
490 486 no changes found
491 487 2 local changesets published
492 488
493 489 Preferring multiple values of an option works
494 490
495 491 $ hg --config ui.clonebundleprefers=COMPRESSION=unknown,COMPRESSION=bzip2 clone -U http://localhost:$HGPORT prefer-multiple-bz
496 492 applying clone bundle from http://localhost:$HGPORT1/bz2-a.hg
497 493 adding changesets
498 494 adding manifests
499 495 adding file changes
500 496 added 2 changesets with 2 changes to 2 files
501 497 finished applying clone bundle
502 498 searching for changes
503 499 no changes found
504 500 2 local changesets published
505 501
506 502 Sorting multiple values should get us back to original first entry
507 503
508 504 $ hg --config ui.clonebundleprefers=BUNDLESPEC=unknown,BUNDLESPEC=gzip-v2,BUNDLESPEC=bzip2-v2 clone -U http://localhost:$HGPORT prefer-multiple-gz
509 505 applying clone bundle from http://localhost:$HGPORT1/gz-a.hg
510 506 adding changesets
511 507 adding manifests
512 508 adding file changes
513 509 added 2 changesets with 2 changes to 2 files
514 510 finished applying clone bundle
515 511 searching for changes
516 512 no changes found
517 513 2 local changesets published
518 514
519 515 Preferring multiple attributes has correct order
520 516
521 517 $ hg --config ui.clonebundleprefers=extra=b,BUNDLESPEC=bzip2-v2 clone -U http://localhost:$HGPORT prefer-separate-attributes
522 518 applying clone bundle from http://localhost:$HGPORT1/bz2-b.hg
523 519 adding changesets
524 520 adding manifests
525 521 adding file changes
526 522 added 2 changesets with 2 changes to 2 files
527 523 finished applying clone bundle
528 524 searching for changes
529 525 no changes found
530 526 2 local changesets published
531 527
532 528 Test where attribute is missing from some entries
533 529
534 530 $ cat > server/.hg/clonebundles.manifest << EOF
535 531 > http://localhost:$HGPORT1/gz-a.hg BUNDLESPEC=gzip-v2
536 532 > http://localhost:$HGPORT1/bz2-a.hg BUNDLESPEC=bzip2-v2
537 533 > http://localhost:$HGPORT1/gz-b.hg BUNDLESPEC=gzip-v2 extra=b
538 534 > http://localhost:$HGPORT1/bz2-b.hg BUNDLESPEC=bzip2-v2 extra=b
539 535 > EOF
540 536
541 537 $ hg --config ui.clonebundleprefers=extra=b clone -U http://localhost:$HGPORT prefer-partially-defined-attribute
542 538 applying clone bundle from http://localhost:$HGPORT1/gz-b.hg
543 539 adding changesets
544 540 adding manifests
545 541 adding file changes
546 542 added 2 changesets with 2 changes to 2 files
547 543 finished applying clone bundle
548 544 searching for changes
549 545 no changes found
550 546 2 local changesets published
551 547
552 548 Test a bad attribute list
553 549
554 550 $ hg --config ui.clonebundleprefers=bad clone -U http://localhost:$HGPORT bad-input
555 551 abort: invalid ui.clonebundleprefers item: bad
556 552 (each comma separated item should be key=value pairs)
557 553 [255]
558 554 $ hg --config ui.clonebundleprefers=key=val,bad,key2=val2 clone \
559 555 > -U http://localhost:$HGPORT bad-input
560 556 abort: invalid ui.clonebundleprefers item: bad
561 557 (each comma separated item should be key=value pairs)
562 558 [255]
563 559
564 560
565 561 Test interaction between clone bundles and --stream
566 562
567 563 A manifest with just a gzip bundle
568 564
569 565 $ cat > server/.hg/clonebundles.manifest << EOF
570 566 > http://localhost:$HGPORT1/gz-a.hg BUNDLESPEC=gzip-v2
571 567 > EOF
572 568
573 569 $ hg clone -U --stream http://localhost:$HGPORT uncompressed-gzip
574 570 no compatible clone bundles available on server; falling back to regular clone
575 571 (you may want to report this to the server operator)
576 572 streaming all changes
577 10 files to transfer, 816 bytes of data (no-rust !)
578 transferred 816 bytes in * seconds (*) (glob) (no-rust !)
579 12 files to transfer, 942 bytes of data (rust !)
580 transferred 942 bytes in *.* seconds (*) (glob) (rust !)
573 * files to transfer, * bytes of data (glob)
574 transferred * bytes in * seconds (* */sec) (glob)
581 575
582 576 A manifest with a stream clone but no BUNDLESPEC
583 577
584 578 $ cat > server/.hg/clonebundles.manifest << EOF
585 579 > http://localhost:$HGPORT1/packed.hg
586 580 > EOF
587 581
588 582 $ hg clone -U --stream http://localhost:$HGPORT uncompressed-no-bundlespec
589 583 no compatible clone bundles available on server; falling back to regular clone
590 584 (you may want to report this to the server operator)
591 585 streaming all changes
592 10 files to transfer, 816 bytes of data (no-rust !)
593 transferred 816 bytes in * seconds (*) (glob) (no-rust !)
594 12 files to transfer, 942 bytes of data (rust !)
595 transferred 942 bytes in *.* seconds (*) (glob) (rust !)
586 * files to transfer, * bytes of data (glob)
587 transferred * bytes in * seconds (* */sec) (glob)
596 588
597 589 A manifest with a gzip bundle and a stream clone
598 590
599 591 $ cat > server/.hg/clonebundles.manifest << EOF
600 592 > http://localhost:$HGPORT1/gz-a.hg BUNDLESPEC=gzip-v2
601 593 > http://localhost:$HGPORT1/packed.hg BUNDLESPEC=none-packed1
602 594 > EOF
603 595
604 596 $ hg clone -U --stream http://localhost:$HGPORT uncompressed-gzip-packed
605 597 applying clone bundle from http://localhost:$HGPORT1/packed.hg
606 5 files to transfer, 613 bytes of data (no-rust !)
607 transferred 613 bytes in *.* seconds (*) (glob) (no-rust !)
608 7 files to transfer, 739 bytes of data (rust !)
609 transferred 739 bytes in *.* seconds (*) (glob) (rust !)
598 * files to transfer, * bytes of data (glob)
599 transferred * bytes in * seconds (* */sec) (glob)
610 600 finished applying clone bundle
611 601 searching for changes
612 602 no changes found
613 603
614 604 A manifest with a gzip bundle and stream clone with supported requirements
615 605
616 606 $ cat > server/.hg/clonebundles.manifest << EOF
617 607 > http://localhost:$HGPORT1/gz-a.hg BUNDLESPEC=gzip-v2
618 608 > http://localhost:$HGPORT1/packed.hg BUNDLESPEC=none-packed1;requirements%3Drevlogv1
619 609 > EOF
620 610
621 611 $ hg clone -U --stream http://localhost:$HGPORT uncompressed-gzip-packed-requirements
622 612 applying clone bundle from http://localhost:$HGPORT1/packed.hg
623 5 files to transfer, 613 bytes of data (no-rust !)
624 transferred 613 bytes in *.* seconds (*) (glob) (no-rust !)
625 7 files to transfer, 739 bytes of data (rust !)
626 transferred 739 bytes in *.* seconds (*) (glob) (rust !)
613 * files to transfer, * bytes of data (glob)
614 transferred * bytes in * seconds (* */sec) (glob)
627 615 finished applying clone bundle
628 616 searching for changes
629 617 no changes found
630 618
631 619 A manifest with a gzip bundle and a stream clone with unsupported requirements
632 620
633 621 $ cat > server/.hg/clonebundles.manifest << EOF
634 622 > http://localhost:$HGPORT1/gz-a.hg BUNDLESPEC=gzip-v2
635 623 > http://localhost:$HGPORT1/packed.hg BUNDLESPEC=none-packed1;requirements%3Drevlogv42
636 624 > EOF
637 625
638 626 $ hg clone -U --stream http://localhost:$HGPORT uncompressed-gzip-packed-unsupported-requirements
639 627 no compatible clone bundles available on server; falling back to regular clone
640 628 (you may want to report this to the server operator)
641 629 streaming all changes
642 10 files to transfer, 816 bytes of data (no-rust !)
643 transferred 816 bytes in * seconds (*) (glob) (no-rust !)
644 12 files to transfer, 942 bytes of data (rust !)
645 transferred 942 bytes in *.* seconds (*) (glob) (rust !)
630 * files to transfer, * bytes of data (glob)
631 transferred * bytes in * seconds (* */sec) (glob)
646 632
647 633 Test clone bundle retrieved through bundle2
648 634
649 635 $ cat << EOF >> $HGRCPATH
650 636 > [extensions]
651 637 > largefiles=
652 638 > EOF
653 639 $ killdaemons.py
654 640 $ hg -R server serve -d -p $HGPORT --pid-file hg.pid --accesslog access.log
655 641 $ cat hg.pid >> $DAEMON_PIDS
656 642
657 643 $ hg -R server debuglfput gz-a.hg
658 644 1f74b3d08286b9b3a16fb3fa185dd29219cbc6ae
659 645
660 646 $ cat > server/.hg/clonebundles.manifest << EOF
661 647 > largefile://1f74b3d08286b9b3a16fb3fa185dd29219cbc6ae BUNDLESPEC=gzip-v2
662 648 > EOF
663 649
664 650 $ hg clone -U http://localhost:$HGPORT largefile-provided --traceback
665 651 applying clone bundle from largefile://1f74b3d08286b9b3a16fb3fa185dd29219cbc6ae
666 652 adding changesets
667 653 adding manifests
668 654 adding file changes
669 655 added 2 changesets with 2 changes to 2 files
670 656 finished applying clone bundle
671 657 searching for changes
672 658 no changes found
673 659 2 local changesets published
674 660 $ killdaemons.py
675 661
676 662 A manifest with a gzip bundle requiring too much memory for a 16MB system and working
677 663 on a 32MB system.
678 664
679 665 $ "$PYTHON" $TESTDIR/dumbhttp.py -p $HGPORT1 --pid http.pid
680 666 $ cat http.pid >> $DAEMON_PIDS
681 667 $ hg -R server serve -d -p $HGPORT --pid-file hg.pid --accesslog access.log
682 668 $ cat hg.pid >> $DAEMON_PIDS
683 669
684 670 $ cat > server/.hg/clonebundles.manifest << EOF
685 671 > http://localhost:$HGPORT1/gz-a.hg BUNDLESPEC=gzip-v2 REQUIREDRAM=12MB
686 672 > EOF
687 673
688 674 $ hg clone -U --debug --config ui.available-memory=16MB http://localhost:$HGPORT gzip-too-large
689 675 using http://localhost:$HGPORT/
690 676 sending capabilities command
691 677 sending clonebundles_manifest command
692 678 filtering http://localhost:$HGPORT1/gz-a.hg as it needs more than 2/3 of system memory
693 679 no compatible clone bundles available on server; falling back to regular clone
694 680 (you may want to report this to the server operator)
695 681 query 1; heads
696 682 sending batch command
697 683 requesting all changes
698 684 sending getbundle command
699 685 bundle2-input-bundle: with-transaction
700 686 bundle2-input-part: "changegroup" (params: 1 mandatory 1 advisory) supported
701 687 adding changesets
702 688 add changeset 53245c60e682
703 689 add changeset aaff8d2ffbbf
704 690 adding manifests
705 691 adding file changes
706 692 adding bar revisions
707 693 adding foo revisions
708 694 bundle2-input-part: total payload size 936
709 695 bundle2-input-part: "listkeys" (params: 1 mandatory) supported
710 696 bundle2-input-part: "phase-heads" supported
711 697 bundle2-input-part: total payload size 24
712 698 bundle2-input-bundle: 3 parts total
713 699 checking for updated bookmarks
714 700 updating the branch cache
715 701 added 2 changesets with 2 changes to 2 files
716 702 new changesets 53245c60e682:aaff8d2ffbbf
717 703 calling hook changegroup.lfiles: hgext.largefiles.reposetup.checkrequireslfiles
718 704 updating the branch cache
719 705 (sent 4 HTTP requests and * bytes; received * bytes in responses) (glob)
720 706
721 707 $ hg clone -U --debug --config ui.available-memory=32MB http://localhost:$HGPORT gzip-too-large2
722 708 using http://localhost:$HGPORT/
723 709 sending capabilities command
724 710 sending clonebundles_manifest command
725 711 applying clone bundle from http://localhost:$HGPORT1/gz-a.hg
726 712 bundle2-input-bundle: 1 params with-transaction
727 713 bundle2-input-part: "changegroup" (params: 1 mandatory 1 advisory) supported
728 714 adding changesets
729 715 add changeset 53245c60e682
730 716 add changeset aaff8d2ffbbf
731 717 adding manifests
732 718 adding file changes
733 719 adding bar revisions
734 720 adding foo revisions
735 721 bundle2-input-part: total payload size 920
736 722 bundle2-input-part: "cache:rev-branch-cache" (advisory) supported
737 723 bundle2-input-part: total payload size 59
738 724 bundle2-input-bundle: 2 parts total
739 725 updating the branch cache
740 726 added 2 changesets with 2 changes to 2 files
741 727 finished applying clone bundle
742 728 query 1; heads
743 729 sending batch command
744 730 searching for changes
745 731 all remote heads known locally
746 732 no changes found
747 733 sending getbundle command
748 734 bundle2-input-bundle: with-transaction
749 735 bundle2-input-part: "listkeys" (params: 1 mandatory) supported
750 736 bundle2-input-part: "phase-heads" supported
751 737 bundle2-input-part: total payload size 24
752 738 bundle2-input-bundle: 2 parts total
753 739 checking for updated bookmarks
754 740 2 local changesets published
755 741 calling hook changegroup.lfiles: hgext.largefiles.reposetup.checkrequireslfiles
756 742 updating the branch cache
757 743 (sent 4 HTTP requests and * bytes; received * bytes in responses) (glob)
758 744 $ killdaemons.py
759 745
760 746 Testing a clone bundles that involves revlog splitting (issue6811)
761 747 ==================================================================
762 748
763 749 $ cat >> $HGRCPATH << EOF
764 750 > [format]
765 751 > revlog-compression=none
766 752 > use-persistent-nodemap=no
767 753 > EOF
768 754
769 755 $ hg init server-revlog-split/
770 756 $ cd server-revlog-split
771 757 $ cat >> .hg/hgrc << EOF
772 758 > [extensions]
773 759 > clonebundles =
774 760 > EOF
775 761 $ echo foo > A
776 762 $ hg add A
777 763 $ hg commit -m 'initial commit'
778 764 IMPORTANT: the revlogs must not be split
779 765 $ ls -1 .hg/store/00manifest.*
780 766 .hg/store/00manifest.i
781 767 $ ls -1 .hg/store/data/_a.*
782 768 .hg/store/data/_a.i
783 769
784 770 do big enough update to split the revlogs
785 771
786 772 $ $TESTDIR/seq.py 100000 > A
787 773 $ mkdir foo
788 774 $ cd foo
789 775 $ touch `$TESTDIR/seq.py 10000`
790 776 $ cd ..
791 777 $ hg add -q foo
792 778 $ hg commit -m 'split the manifest and one filelog'
793 779
794 780 IMPORTANT: now the revlogs must be split
795 781 $ ls -1 .hg/store/00manifest.*
796 782 .hg/store/00manifest.d
797 783 .hg/store/00manifest.i
798 784 $ ls -1 .hg/store/data/_a.*
799 785 .hg/store/data/_a.d
800 786 .hg/store/data/_a.i
801 787
802 788 Add an extra commit on top of that
803 789
804 790 $ echo foo >> A
805 791 $ hg commit -m 'one extra commit'
806 792
807 793 $ cd ..
808 794
809 795 Do a bundle that contains the split, but not the update
810 796
811 797 $ hg bundle --exact --rev '::(default~1)' -R server-revlog-split/ --type gzip-v2 split-test.hg
812 798 2 changesets found
813 799
814 800 $ cat > server-revlog-split/.hg/clonebundles.manifest << EOF
815 801 > http://localhost:$HGPORT1/split-test.hg BUNDLESPEC=gzip-v2
816 802 > EOF
817 803
818 804 start the necessary server
819 805
820 806 $ "$PYTHON" $TESTDIR/dumbhttp.py -p $HGPORT1 --pid http.pid
821 807 $ cat http.pid >> $DAEMON_PIDS
822 808 $ hg -R server-revlog-split serve -d -p $HGPORT --pid-file hg.pid --accesslog access.log
823 809 $ cat hg.pid >> $DAEMON_PIDS
824 810
825 811 Check that clone works fine
826 812 ===========================
827 813
828 814 Here, the initial clone will trigger a revlog split (which is a bit clowny it
829 815 itself, but whatever). The split revlogs will see additionnal data added to
830 816 them in the subsequent pull. This should not be a problem
831 817
832 818 $ hg clone http://localhost:$HGPORT revlog-split-in-the-bundle
833 819 applying clone bundle from http://localhost:$HGPORT1/split-test.hg
834 820 adding changesets
835 821 adding manifests
836 822 adding file changes
837 823 added 2 changesets with 10002 changes to 10001 files
838 824 finished applying clone bundle
839 825 searching for changes
840 826 adding changesets
841 827 adding manifests
842 828 adding file changes
843 829 added 1 changesets with 1 changes to 1 files
844 830 new changesets e3879eaa1db7
845 831 2 local changesets published
846 832 updating to branch default
847 833 10001 files updated, 0 files merged, 0 files removed, 0 files unresolved
848 834
849 835 check the results
850 836
851 837 $ cd revlog-split-in-the-bundle
852 838 $ f --size .hg/store/00manifest.*
853 839 .hg/store/00manifest.d: size=499037
854 840 .hg/store/00manifest.i: size=192
855 841 $ f --size .hg/store/data/_a.*
856 842 .hg/store/data/_a.d: size=588917
857 843 .hg/store/data/_a.i: size=192
858 844
859 845 manifest should work
860 846
861 847 $ hg files -r tip | wc -l
862 848 \s*10001 (re)
863 849
864 850 file content should work
865 851
866 852 $ hg cat -r tip A | wc -l
867 853 \s*100001 (re)
868 854
869 855
General Comments 0
You need to be logged in to leave comments. Login now