comparison tests/test-clone-stream.t @ 48041:37a41267d000

branching: merge stable into default
author Raphaël Gomès <rgomes@octobus.net>
date Tue, 28 Sep 2021 09:40:57 +0200
parents tests/test-clone-uncompressed.t@132525ead0db tests/test-clone-uncompressed.t@31a72e5e9200
children d3222525bc8e
comparison
equal deleted inserted replaced
48040:7970895a21cb 48041:37a41267d000
1 #require serve no-reposimplestore no-chg
2
3 #testcases stream-legacy stream-bundle2
4
5 #if stream-legacy
6 $ cat << EOF >> $HGRCPATH
7 > [server]
8 > bundle2.stream = no
9 > EOF
10 #endif
11
12 Initialize repository
13 the status call is to check for issue5130
14
15 $ hg init server
16 $ cd server
17 $ touch foo
18 $ hg -q commit -A -m initial
19 >>> for i in range(1024):
20 ... with open(str(i), 'wb') as fh:
21 ... fh.write(b"%d" % i) and None
22 $ hg -q commit -A -m 'add a lot of files'
23 $ hg st
24
25 add files with "tricky" name:
26
27 $ echo foo > 00changelog.i
28 $ echo foo > 00changelog.d
29 $ echo foo > 00changelog.n
30 $ echo foo > 00changelog-ab349180a0405010.nd
31 $ echo foo > 00manifest.i
32 $ echo foo > 00manifest.d
33 $ echo foo > foo.i
34 $ echo foo > foo.d
35 $ echo foo > foo.n
36 $ echo foo > undo.py
37 $ echo foo > undo.i
38 $ echo foo > undo.d
39 $ echo foo > undo.n
40 $ echo foo > undo.foo.i
41 $ echo foo > undo.foo.d
42 $ echo foo > undo.foo.n
43 $ echo foo > undo.babar
44 $ mkdir savanah
45 $ echo foo > savanah/foo.i
46 $ echo foo > savanah/foo.d
47 $ echo foo > savanah/foo.n
48 $ echo foo > savanah/undo.py
49 $ echo foo > savanah/undo.i
50 $ echo foo > savanah/undo.d
51 $ echo foo > savanah/undo.n
52 $ echo foo > savanah/undo.foo.i
53 $ echo foo > savanah/undo.foo.d
54 $ echo foo > savanah/undo.foo.n
55 $ echo foo > savanah/undo.babar
56 $ mkdir data
57 $ echo foo > data/foo.i
58 $ echo foo > data/foo.d
59 $ echo foo > data/foo.n
60 $ echo foo > data/undo.py
61 $ echo foo > data/undo.i
62 $ echo foo > data/undo.d
63 $ echo foo > data/undo.n
64 $ echo foo > data/undo.foo.i
65 $ echo foo > data/undo.foo.d
66 $ echo foo > data/undo.foo.n
67 $ echo foo > data/undo.babar
68 $ mkdir meta
69 $ echo foo > meta/foo.i
70 $ echo foo > meta/foo.d
71 $ echo foo > meta/foo.n
72 $ echo foo > meta/undo.py
73 $ echo foo > meta/undo.i
74 $ echo foo > meta/undo.d
75 $ echo foo > meta/undo.n
76 $ echo foo > meta/undo.foo.i
77 $ echo foo > meta/undo.foo.d
78 $ echo foo > meta/undo.foo.n
79 $ echo foo > meta/undo.babar
80 $ mkdir store
81 $ echo foo > store/foo.i
82 $ echo foo > store/foo.d
83 $ echo foo > store/foo.n
84 $ echo foo > store/undo.py
85 $ echo foo > store/undo.i
86 $ echo foo > store/undo.d
87 $ echo foo > store/undo.n
88 $ echo foo > store/undo.foo.i
89 $ echo foo > store/undo.foo.d
90 $ echo foo > store/undo.foo.n
91 $ echo foo > store/undo.babar
92
93 Name with special characters
94
95 $ echo foo > store/CélesteVille_is_a_Capital_City
96
97 name causing issue6581
98
99 $ mkdir --parents container/isam-build-centos7/
100 $ touch container/isam-build-centos7/bazel-coverage-generator-sandboxfs-compatibility-0758e3e4f6057904d44399bd666faba9e7f40686.patch
101
102 Add all that
103
104 $ hg add .
105 adding 00changelog-ab349180a0405010.nd
106 adding 00changelog.d
107 adding 00changelog.i
108 adding 00changelog.n
109 adding 00manifest.d
110 adding 00manifest.i
111 adding container/isam-build-centos7/bazel-coverage-generator-sandboxfs-compatibility-0758e3e4f6057904d44399bd666faba9e7f40686.patch
112 adding data/foo.d
113 adding data/foo.i
114 adding data/foo.n
115 adding data/undo.babar
116 adding data/undo.d
117 adding data/undo.foo.d
118 adding data/undo.foo.i
119 adding data/undo.foo.n
120 adding data/undo.i
121 adding data/undo.n
122 adding data/undo.py
123 adding foo.d
124 adding foo.i
125 adding foo.n
126 adding meta/foo.d
127 adding meta/foo.i
128 adding meta/foo.n
129 adding meta/undo.babar
130 adding meta/undo.d
131 adding meta/undo.foo.d
132 adding meta/undo.foo.i
133 adding meta/undo.foo.n
134 adding meta/undo.i
135 adding meta/undo.n
136 adding meta/undo.py
137 adding savanah/foo.d
138 adding savanah/foo.i
139 adding savanah/foo.n
140 adding savanah/undo.babar
141 adding savanah/undo.d
142 adding savanah/undo.foo.d
143 adding savanah/undo.foo.i
144 adding savanah/undo.foo.n
145 adding savanah/undo.i
146 adding savanah/undo.n
147 adding savanah/undo.py
148 adding store/C\xc3\xa9lesteVille_is_a_Capital_City (esc)
149 adding store/foo.d
150 adding store/foo.i
151 adding store/foo.n
152 adding store/undo.babar
153 adding store/undo.d
154 adding store/undo.foo.d
155 adding store/undo.foo.i
156 adding store/undo.foo.n
157 adding store/undo.i
158 adding store/undo.n
159 adding store/undo.py
160 adding undo.babar
161 adding undo.d
162 adding undo.foo.d
163 adding undo.foo.i
164 adding undo.foo.n
165 adding undo.i
166 adding undo.n
167 adding undo.py
168 $ hg ci -m 'add files with "tricky" name'
169 $ hg --config server.uncompressed=false serve -p $HGPORT -d --pid-file=hg.pid
170 $ cat hg.pid > $DAEMON_PIDS
171 $ cd ..
172
173 Check local clone
174 ==================
175
176 The logic is close enough of uncompressed.
177 This is present here to reuse the testing around file with "special" names.
178
179 $ hg clone server local-clone
180 updating to branch default
181 1088 files updated, 0 files merged, 0 files removed, 0 files unresolved
182
183 Check that the clone went well
184
185 $ hg verify -R local-clone
186 checking changesets
187 checking manifests
188 crosschecking files in changesets and manifests
189 checking files
190 checked 3 changesets with 1088 changes to 1088 files
191
192 Check uncompressed
193 ==================
194
195 Cannot stream clone when server.uncompressed is set
196
197 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=stream_out'
198 200 Script output follows
199
200 1
201
202 #if stream-legacy
203 $ hg debugcapabilities http://localhost:$HGPORT
204 Main capabilities:
205 batch
206 branchmap
207 $USUAL_BUNDLE2_CAPS_SERVER$
208 changegroupsubset
209 compression=$BUNDLE2_COMPRESSIONS$
210 getbundle
211 httpheader=1024
212 httpmediatype=0.1rx,0.1tx,0.2tx
213 known
214 lookup
215 pushkey
216 unbundle=HG10GZ,HG10BZ,HG10UN
217 unbundlehash
218 Bundle2 capabilities:
219 HG20
220 bookmarks
221 changegroup
222 01
223 02
224 checkheads
225 related
226 digests
227 md5
228 sha1
229 sha512
230 error
231 abort
232 unsupportedcontent
233 pushraced
234 pushkey
235 hgtagsfnodes
236 listkeys
237 phases
238 heads
239 pushkey
240 remote-changegroup
241 http
242 https
243
244 $ hg clone --stream -U http://localhost:$HGPORT server-disabled
245 warning: stream clone requested but server has them disabled
246 requesting all changes
247 adding changesets
248 adding manifests
249 adding file changes
250 added 3 changesets with 1088 changes to 1088 files
251 new changesets 96ee1d7354c4:5223b5e3265f
252
253 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=getbundle' content-type --bodyfile body --hgproto 0.2 --requestheader "x-hgarg-1=bundlecaps=HG20%2Cbundle2%3DHG20%250Abookmarks%250Achangegroup%253D01%252C02%250Adigests%253Dmd5%252Csha1%252Csha512%250Aerror%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250Ahgtagsfnodes%250Alistkeys%250Aphases%253Dheads%250Apushkey%250Aremote-changegroup%253Dhttp%252Chttps&cg=0&common=0000000000000000000000000000000000000000&heads=c17445101a72edac06facd130d14808dfbd5c7c2&stream=1"
254 200 Script output follows
255 content-type: application/mercurial-0.2
256
257
258 $ f --size body --hexdump --bytes 100
259 body: size=232
260 0000: 04 6e 6f 6e 65 48 47 32 30 00 00 00 00 00 00 00 |.noneHG20.......|
261 0010: cf 0b 45 52 52 4f 52 3a 41 42 4f 52 54 00 00 00 |..ERROR:ABORT...|
262 0020: 00 01 01 07 3c 04 72 6d 65 73 73 61 67 65 73 74 |....<.rmessagest|
263 0030: 72 65 61 6d 20 64 61 74 61 20 72 65 71 75 65 73 |ream data reques|
264 0040: 74 65 64 20 62 75 74 20 73 65 72 76 65 72 20 64 |ted but server d|
265 0050: 6f 65 73 20 6e 6f 74 20 61 6c 6c 6f 77 20 74 68 |oes not allow th|
266 0060: 69 73 20 66 |is f|
267
268 #endif
269 #if stream-bundle2
270 $ hg debugcapabilities http://localhost:$HGPORT
271 Main capabilities:
272 batch
273 branchmap
274 $USUAL_BUNDLE2_CAPS_SERVER$
275 changegroupsubset
276 compression=$BUNDLE2_COMPRESSIONS$
277 getbundle
278 httpheader=1024
279 httpmediatype=0.1rx,0.1tx,0.2tx
280 known
281 lookup
282 pushkey
283 unbundle=HG10GZ,HG10BZ,HG10UN
284 unbundlehash
285 Bundle2 capabilities:
286 HG20
287 bookmarks
288 changegroup
289 01
290 02
291 checkheads
292 related
293 digests
294 md5
295 sha1
296 sha512
297 error
298 abort
299 unsupportedcontent
300 pushraced
301 pushkey
302 hgtagsfnodes
303 listkeys
304 phases
305 heads
306 pushkey
307 remote-changegroup
308 http
309 https
310
311 $ hg clone --stream -U http://localhost:$HGPORT server-disabled
312 warning: stream clone requested but server has them disabled
313 requesting all changes
314 adding changesets
315 adding manifests
316 adding file changes
317 added 3 changesets with 1088 changes to 1088 files
318 new changesets 96ee1d7354c4:5223b5e3265f
319
320 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=getbundle' content-type --bodyfile body --hgproto 0.2 --requestheader "x-hgarg-1=bundlecaps=HG20%2Cbundle2%3DHG20%250Abookmarks%250Achangegroup%253D01%252C02%250Adigests%253Dmd5%252Csha1%252Csha512%250Aerror%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250Ahgtagsfnodes%250Alistkeys%250Aphases%253Dheads%250Apushkey%250Aremote-changegroup%253Dhttp%252Chttps&cg=0&common=0000000000000000000000000000000000000000&heads=c17445101a72edac06facd130d14808dfbd5c7c2&stream=1"
321 200 Script output follows
322 content-type: application/mercurial-0.2
323
324
325 $ f --size body --hexdump --bytes 100
326 body: size=232
327 0000: 04 6e 6f 6e 65 48 47 32 30 00 00 00 00 00 00 00 |.noneHG20.......|
328 0010: cf 0b 45 52 52 4f 52 3a 41 42 4f 52 54 00 00 00 |..ERROR:ABORT...|
329 0020: 00 01 01 07 3c 04 72 6d 65 73 73 61 67 65 73 74 |....<.rmessagest|
330 0030: 72 65 61 6d 20 64 61 74 61 20 72 65 71 75 65 73 |ream data reques|
331 0040: 74 65 64 20 62 75 74 20 73 65 72 76 65 72 20 64 |ted but server d|
332 0050: 6f 65 73 20 6e 6f 74 20 61 6c 6c 6f 77 20 74 68 |oes not allow th|
333 0060: 69 73 20 66 |is f|
334
335 #endif
336
337 $ killdaemons.py
338 $ cd server
339 $ hg serve -p $HGPORT -d --pid-file=hg.pid --error errors.txt
340 $ cat hg.pid > $DAEMON_PIDS
341 $ cd ..
342
343 Basic clone
344
345 #if stream-legacy
346 $ hg clone --stream -U http://localhost:$HGPORT clone1
347 streaming all changes
348 1090 files to transfer, 102 KB of data (no-zstd !)
349 transferred 102 KB in * seconds (* */sec) (glob) (no-zstd !)
350 1090 files to transfer, 98.8 KB of data (zstd !)
351 transferred 98.8 KB in * seconds (* */sec) (glob) (zstd !)
352 searching for changes
353 no changes found
354 $ cat server/errors.txt
355 #endif
356 #if stream-bundle2
357 $ hg clone --stream -U http://localhost:$HGPORT clone1
358 streaming all changes
359 1093 files to transfer, 102 KB of data (no-zstd !)
360 transferred 102 KB in * seconds (* */sec) (glob) (no-zstd !)
361 1093 files to transfer, 98.9 KB of data (zstd !)
362 transferred 98.9 KB in * seconds (* */sec) (glob) (zstd !)
363
364 $ ls -1 clone1/.hg/cache
365 branch2-base
366 branch2-immutable
367 branch2-served
368 branch2-served.hidden
369 branch2-visible
370 branch2-visible-hidden
371 rbc-names-v1
372 rbc-revs-v1
373 tags2
374 tags2-served
375 $ cat server/errors.txt
376 #endif
377
378 getbundle requests with stream=1 are uncompressed
379
380 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=getbundle' content-type --bodyfile body --hgproto '0.1 0.2 comp=zlib,none' --requestheader "x-hgarg-1=bundlecaps=HG20%2Cbundle2%3DHG20%250Abookmarks%250Achangegroup%253D01%252C02%250Adigests%253Dmd5%252Csha1%252Csha512%250Aerror%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250Ahgtagsfnodes%250Alistkeys%250Aphases%253Dheads%250Apushkey%250Aremote-changegroup%253Dhttp%252Chttps&cg=0&common=0000000000000000000000000000000000000000&heads=c17445101a72edac06facd130d14808dfbd5c7c2&stream=1"
381 200 Script output follows
382 content-type: application/mercurial-0.2
383
384
385 #if no-zstd no-rust
386 $ f --size --hex --bytes 256 body
387 body: size=119153
388 0000: 04 6e 6f 6e 65 48 47 32 30 00 00 00 00 00 00 00 |.noneHG20.......|
389 0010: 80 07 53 54 52 45 41 4d 32 00 00 00 00 03 00 09 |..STREAM2.......|
390 0020: 06 09 04 0c 44 62 79 74 65 63 6f 75 6e 74 31 30 |....Dbytecount10|
391 0030: 34 31 31 35 66 69 6c 65 63 6f 75 6e 74 31 30 39 |4115filecount109|
392 0040: 33 72 65 71 75 69 72 65 6d 65 6e 74 73 64 6f 74 |3requirementsdot|
393 0050: 65 6e 63 6f 64 65 25 32 43 66 6e 63 61 63 68 65 |encode%2Cfncache|
394 0060: 25 32 43 67 65 6e 65 72 61 6c 64 65 6c 74 61 25 |%2Cgeneraldelta%|
395 0070: 32 43 72 65 76 6c 6f 67 76 31 25 32 43 73 70 61 |2Crevlogv1%2Cspa|
396 0080: 72 73 65 72 65 76 6c 6f 67 25 32 43 73 74 6f 72 |rserevlog%2Cstor|
397 0090: 65 00 00 80 00 73 08 42 64 61 74 61 2f 30 2e 69 |e....s.Bdata/0.i|
398 00a0: 00 03 00 01 00 00 00 00 00 00 00 02 00 00 00 01 |................|
399 00b0: 00 00 00 00 00 00 00 01 ff ff ff ff ff ff ff ff |................|
400 00c0: 80 29 63 a0 49 d3 23 87 bf ce fe 56 67 92 67 2c |.)c.I.#....Vg.g,|
401 00d0: 69 d1 ec 39 00 00 00 00 00 00 00 00 00 00 00 00 |i..9............|
402 00e0: 75 30 73 26 45 64 61 74 61 2f 30 30 63 68 61 6e |u0s&Edata/00chan|
403 00f0: 67 65 6c 6f 67 2d 61 62 33 34 39 31 38 30 61 30 |gelog-ab349180a0|
404 #endif
405 #if zstd no-rust
406 $ f --size --hex --bytes 256 body
407 body: size=116340
408 0000: 04 6e 6f 6e 65 48 47 32 30 00 00 00 00 00 00 00 |.noneHG20.......|
409 0010: 9a 07 53 54 52 45 41 4d 32 00 00 00 00 03 00 09 |..STREAM2.......|
410 0020: 06 09 04 0c 5e 62 79 74 65 63 6f 75 6e 74 31 30 |....^bytecount10|
411 0030: 31 32 37 36 66 69 6c 65 63 6f 75 6e 74 31 30 39 |1276filecount109|
412 0040: 33 72 65 71 75 69 72 65 6d 65 6e 74 73 64 6f 74 |3requirementsdot|
413 0050: 65 6e 63 6f 64 65 25 32 43 66 6e 63 61 63 68 65 |encode%2Cfncache|
414 0060: 25 32 43 67 65 6e 65 72 61 6c 64 65 6c 74 61 25 |%2Cgeneraldelta%|
415 0070: 32 43 72 65 76 6c 6f 67 2d 63 6f 6d 70 72 65 73 |2Crevlog-compres|
416 0080: 73 69 6f 6e 2d 7a 73 74 64 25 32 43 72 65 76 6c |sion-zstd%2Crevl|
417 0090: 6f 67 76 31 25 32 43 73 70 61 72 73 65 72 65 76 |ogv1%2Csparserev|
418 00a0: 6c 6f 67 25 32 43 73 74 6f 72 65 00 00 80 00 73 |log%2Cstore....s|
419 00b0: 08 42 64 61 74 61 2f 30 2e 69 00 03 00 01 00 00 |.Bdata/0.i......|
420 00c0: 00 00 00 00 00 02 00 00 00 01 00 00 00 00 00 00 |................|
421 00d0: 00 01 ff ff ff ff ff ff ff ff 80 29 63 a0 49 d3 |...........)c.I.|
422 00e0: 23 87 bf ce fe 56 67 92 67 2c 69 d1 ec 39 00 00 |#....Vg.g,i..9..|
423 00f0: 00 00 00 00 00 00 00 00 00 00 75 30 73 26 45 64 |..........u0s&Ed|
424 #endif
425 #if zstd rust no-dirstate-v2
426 $ f --size --hex --bytes 256 body
427 body: size=116361
428 0000: 04 6e 6f 6e 65 48 47 32 30 00 00 00 00 00 00 00 |.noneHG20.......|
429 0010: af 07 53 54 52 45 41 4d 32 00 00 00 00 03 00 09 |..STREAM2.......|
430 0020: 06 09 04 0c 73 62 79 74 65 63 6f 75 6e 74 31 30 |....sbytecount10|
431 0030: 31 32 37 36 66 69 6c 65 63 6f 75 6e 74 31 30 39 |1276filecount109|
432 0040: 33 72 65 71 75 69 72 65 6d 65 6e 74 73 64 6f 74 |3requirementsdot|
433 0050: 65 6e 63 6f 64 65 25 32 43 66 6e 63 61 63 68 65 |encode%2Cfncache|
434 0060: 25 32 43 67 65 6e 65 72 61 6c 64 65 6c 74 61 25 |%2Cgeneraldelta%|
435 0070: 32 43 70 65 72 73 69 73 74 65 6e 74 2d 6e 6f 64 |2Cpersistent-nod|
436 0080: 65 6d 61 70 25 32 43 72 65 76 6c 6f 67 2d 63 6f |emap%2Crevlog-co|
437 0090: 6d 70 72 65 73 73 69 6f 6e 2d 7a 73 74 64 25 32 |mpression-zstd%2|
438 00a0: 43 72 65 76 6c 6f 67 76 31 25 32 43 73 70 61 72 |Crevlogv1%2Cspar|
439 00b0: 73 65 72 65 76 6c 6f 67 25 32 43 73 74 6f 72 65 |serevlog%2Cstore|
440 00c0: 00 00 80 00 73 08 42 64 61 74 61 2f 30 2e 69 00 |....s.Bdata/0.i.|
441 00d0: 03 00 01 00 00 00 00 00 00 00 02 00 00 00 01 00 |................|
442 00e0: 00 00 00 00 00 00 01 ff ff ff ff ff ff ff ff 80 |................|
443 00f0: 29 63 a0 49 d3 23 87 bf ce fe 56 67 92 67 2c 69 |)c.I.#....Vg.g,i|
444 #endif
445 #if zstd dirstate-v2
446 $ f --size --hex --bytes 256 body
447 body: size=109549
448 0000: 04 6e 6f 6e 65 48 47 32 30 00 00 00 00 00 00 00 |.noneHG20.......|
449 0010: c0 07 53 54 52 45 41 4d 32 00 00 00 00 03 00 09 |..STREAM2.......|
450 0020: 05 09 04 0c 85 62 79 74 65 63 6f 75 6e 74 39 35 |.....bytecount95|
451 0030: 38 39 37 66 69 6c 65 63 6f 75 6e 74 31 30 33 30 |897filecount1030|
452 0040: 72 65 71 75 69 72 65 6d 65 6e 74 73 64 6f 74 65 |requirementsdote|
453 0050: 6e 63 6f 64 65 25 32 43 65 78 70 2d 64 69 72 73 |ncode%2Cexp-dirs|
454 0060: 74 61 74 65 2d 76 32 25 32 43 66 6e 63 61 63 68 |tate-v2%2Cfncach|
455 0070: 65 25 32 43 67 65 6e 65 72 61 6c 64 65 6c 74 61 |e%2Cgeneraldelta|
456 0080: 25 32 43 70 65 72 73 69 73 74 65 6e 74 2d 6e 6f |%2Cpersistent-no|
457 0090: 64 65 6d 61 70 25 32 43 72 65 76 6c 6f 67 2d 63 |demap%2Crevlog-c|
458 00a0: 6f 6d 70 72 65 73 73 69 6f 6e 2d 7a 73 74 64 25 |ompression-zstd%|
459 00b0: 32 43 72 65 76 6c 6f 67 76 31 25 32 43 73 70 61 |2Crevlogv1%2Cspa|
460 00c0: 72 73 65 72 65 76 6c 6f 67 25 32 43 73 74 6f 72 |rserevlog%2Cstor|
461 00d0: 65 00 00 80 00 73 08 42 64 61 74 61 2f 30 2e 69 |e....s.Bdata/0.i|
462 00e0: 00 03 00 01 00 00 00 00 00 00 00 02 00 00 00 01 |................|
463 00f0: 00 00 00 00 00 00 00 01 ff ff ff ff ff ff ff ff |................|
464 #endif
465
466 --uncompressed is an alias to --stream
467
468 #if stream-legacy
469 $ hg clone --uncompressed -U http://localhost:$HGPORT clone1-uncompressed
470 streaming all changes
471 1090 files to transfer, 102 KB of data (no-zstd !)
472 transferred 102 KB in * seconds (* */sec) (glob) (no-zstd !)
473 1090 files to transfer, 98.8 KB of data (zstd !)
474 transferred 98.8 KB in * seconds (* */sec) (glob) (zstd !)
475 searching for changes
476 no changes found
477 #endif
478 #if stream-bundle2
479 $ hg clone --uncompressed -U http://localhost:$HGPORT clone1-uncompressed
480 streaming all changes
481 1093 files to transfer, 102 KB of data (no-zstd !)
482 transferred 102 KB in * seconds (* */sec) (glob) (no-zstd !)
483 1093 files to transfer, 98.9 KB of data (zstd !)
484 transferred 98.9 KB in * seconds (* */sec) (glob) (zstd !)
485 #endif
486
487 Clone with background file closing enabled
488
489 #if stream-legacy
490 $ hg --debug --config worker.backgroundclose=true --config worker.backgroundcloseminfilecount=1 clone --stream -U http://localhost:$HGPORT clone-background | grep -v adding
491 using http://localhost:$HGPORT/
492 sending capabilities command
493 sending branchmap command
494 streaming all changes
495 sending stream_out command
496 1090 files to transfer, 102 KB of data (no-zstd !)
497 1090 files to transfer, 98.8 KB of data (zstd !)
498 starting 4 threads for background file closing
499 updating the branch cache
500 transferred 102 KB in * seconds (* */sec) (glob) (no-zstd !)
501 transferred 98.8 KB in * seconds (* */sec) (glob) (zstd !)
502 query 1; heads
503 sending batch command
504 searching for changes
505 all remote heads known locally
506 no changes found
507 sending getbundle command
508 bundle2-input-bundle: with-transaction
509 bundle2-input-part: "listkeys" (params: 1 mandatory) supported
510 bundle2-input-part: "phase-heads" supported
511 bundle2-input-part: total payload size 24
512 bundle2-input-bundle: 2 parts total
513 checking for updated bookmarks
514 updating the branch cache
515 (sent 5 HTTP requests and * bytes; received * bytes in responses) (glob)
516 #endif
517 #if stream-bundle2
518 $ hg --debug --config worker.backgroundclose=true --config worker.backgroundcloseminfilecount=1 clone --stream -U http://localhost:$HGPORT clone-background | grep -v adding
519 using http://localhost:$HGPORT/
520 sending capabilities command
521 query 1; heads
522 sending batch command
523 streaming all changes
524 sending getbundle command
525 bundle2-input-bundle: with-transaction
526 bundle2-input-part: "stream2" (params: 3 mandatory) supported
527 applying stream bundle
528 1093 files to transfer, 102 KB of data (no-zstd !)
529 1093 files to transfer, 98.9 KB of data (zstd !)
530 starting 4 threads for background file closing
531 starting 4 threads for background file closing
532 updating the branch cache
533 transferred 102 KB in * seconds (* */sec) (glob) (no-zstd !)
534 bundle2-input-part: total payload size 118984 (no-zstd !)
535 transferred 98.9 KB in * seconds (* */sec) (glob) (zstd !)
536 bundle2-input-part: total payload size 116145 (zstd !)
537 bundle2-input-part: "listkeys" (params: 1 mandatory) supported
538 bundle2-input-bundle: 2 parts total
539 checking for updated bookmarks
540 updating the branch cache
541 (sent 3 HTTP requests and * bytes; received * bytes in responses) (glob)
542 #endif
543
544 Cannot stream clone when there are secret changesets
545
546 $ hg -R server phase --force --secret -r tip
547 $ hg clone --stream -U http://localhost:$HGPORT secret-denied
548 warning: stream clone requested but server has them disabled
549 requesting all changes
550 adding changesets
551 adding manifests
552 adding file changes
553 added 2 changesets with 1025 changes to 1025 files
554 new changesets 96ee1d7354c4:c17445101a72
555
556 $ killdaemons.py
557
558 Streaming of secrets can be overridden by server config
559
560 $ cd server
561 $ hg serve --config server.uncompressedallowsecret=true -p $HGPORT -d --pid-file=hg.pid
562 $ cat hg.pid > $DAEMON_PIDS
563 $ cd ..
564
565 #if stream-legacy
566 $ hg clone --stream -U http://localhost:$HGPORT secret-allowed
567 streaming all changes
568 1090 files to transfer, 102 KB of data (no-zstd !)
569 transferred 102 KB in * seconds (* */sec) (glob) (no-zstd !)
570 1090 files to transfer, 98.8 KB of data (zstd !)
571 transferred 98.8 KB in * seconds (* */sec) (glob) (zstd !)
572 searching for changes
573 no changes found
574 #endif
575 #if stream-bundle2
576 $ hg clone --stream -U http://localhost:$HGPORT secret-allowed
577 streaming all changes
578 1093 files to transfer, 102 KB of data (no-zstd !)
579 transferred 102 KB in * seconds (* */sec) (glob) (no-zstd !)
580 1093 files to transfer, 98.9 KB of data (zstd !)
581 transferred 98.9 KB in * seconds (* */sec) (glob) (zstd !)
582 #endif
583
584 $ killdaemons.py
585
586 Verify interaction between preferuncompressed and secret presence
587
588 $ cd server
589 $ hg serve --config server.preferuncompressed=true -p $HGPORT -d --pid-file=hg.pid
590 $ cat hg.pid > $DAEMON_PIDS
591 $ cd ..
592
593 $ hg clone -U http://localhost:$HGPORT preferuncompressed-secret
594 requesting all changes
595 adding changesets
596 adding manifests
597 adding file changes
598 added 2 changesets with 1025 changes to 1025 files
599 new changesets 96ee1d7354c4:c17445101a72
600
601 $ killdaemons.py
602
603 Clone not allowed when full bundles disabled and can't serve secrets
604
605 $ cd server
606 $ hg serve --config server.disablefullbundle=true -p $HGPORT -d --pid-file=hg.pid
607 $ cat hg.pid > $DAEMON_PIDS
608 $ cd ..
609
610 $ hg clone --stream http://localhost:$HGPORT secret-full-disabled
611 warning: stream clone requested but server has them disabled
612 requesting all changes
613 remote: abort: server has pull-based clones disabled
614 abort: pull failed on remote
615 (remove --pull if specified or upgrade Mercurial)
616 [100]
617
618 Local stream clone with secrets involved
619 (This is just a test over behavior: if you have access to the repo's files,
620 there is no security so it isn't important to prevent a clone here.)
621
622 $ hg clone -U --stream server local-secret
623 warning: stream clone requested but server has them disabled
624 requesting all changes
625 adding changesets
626 adding manifests
627 adding file changes
628 added 2 changesets with 1025 changes to 1025 files
629 new changesets 96ee1d7354c4:c17445101a72
630
631 Stream clone while repo is changing:
632
633 $ mkdir changing
634 $ cd changing
635
636 extension for delaying the server process so we reliably can modify the repo
637 while cloning
638
639 $ cat > stream_steps.py <<EOF
640 > import os
641 > import sys
642 > from mercurial import (
643 > encoding,
644 > extensions,
645 > streamclone,
646 > testing,
647 > )
648 > WALKED_FILE_1 = encoding.environ[b'HG_TEST_STREAM_WALKED_FILE_1']
649 > WALKED_FILE_2 = encoding.environ[b'HG_TEST_STREAM_WALKED_FILE_2']
650 >
651 > def _test_sync_point_walk_1(orig, repo):
652 > testing.write_file(WALKED_FILE_1)
653 >
654 > def _test_sync_point_walk_2(orig, repo):
655 > assert repo._currentlock(repo._lockref) is None
656 > testing.wait_file(WALKED_FILE_2)
657 >
658 > extensions.wrapfunction(
659 > streamclone,
660 > '_test_sync_point_walk_1',
661 > _test_sync_point_walk_1
662 > )
663 > extensions.wrapfunction(
664 > streamclone,
665 > '_test_sync_point_walk_2',
666 > _test_sync_point_walk_2
667 > )
668 > EOF
669
670 prepare repo with small and big file to cover both code paths in emitrevlogdata
671
672 $ hg init repo
673 $ touch repo/f1
674 $ $TESTDIR/seq.py 50000 > repo/f2
675 $ hg -R repo ci -Aqm "0"
676 $ HG_TEST_STREAM_WALKED_FILE_1="$TESTTMP/sync_file_walked_1"
677 $ export HG_TEST_STREAM_WALKED_FILE_1
678 $ HG_TEST_STREAM_WALKED_FILE_2="$TESTTMP/sync_file_walked_2"
679 $ export HG_TEST_STREAM_WALKED_FILE_2
680 $ HG_TEST_STREAM_WALKED_FILE_3="$TESTTMP/sync_file_walked_3"
681 $ export HG_TEST_STREAM_WALKED_FILE_3
682 # $ cat << EOF >> $HGRCPATH
683 # > [hooks]
684 # > pre-clone=rm -f "$TESTTMP/sync_file_walked_*"
685 # > EOF
686 $ hg serve -R repo -p $HGPORT1 -d --error errors.log --pid-file=hg.pid --config extensions.stream_steps="$RUNTESTDIR/testlib/ext-stream-clone-steps.py"
687 $ cat hg.pid >> $DAEMON_PIDS
688
689 clone while modifying the repo between stating file with write lock and
690 actually serving file content
691
692 $ (hg clone -q --stream -U http://localhost:$HGPORT1 clone; touch "$HG_TEST_STREAM_WALKED_FILE_3") &
693 $ $RUNTESTDIR/testlib/wait-on-file 10 $HG_TEST_STREAM_WALKED_FILE_1
694 $ echo >> repo/f1
695 $ echo >> repo/f2
696 $ hg -R repo ci -m "1" --config ui.timeout.warn=-1
697 $ touch $HG_TEST_STREAM_WALKED_FILE_2
698 $ $RUNTESTDIR/testlib/wait-on-file 10 $HG_TEST_STREAM_WALKED_FILE_3
699 $ hg -R clone id
700 000000000000
701 $ cat errors.log
702 $ cd ..
703
704 Stream repository with bookmarks
705 --------------------------------
706
707 (revert introduction of secret changeset)
708
709 $ hg -R server phase --draft 'secret()'
710
711 add a bookmark
712
713 $ hg -R server bookmark -r tip some-bookmark
714
715 clone it
716
717 #if stream-legacy
718 $ hg clone --stream http://localhost:$HGPORT with-bookmarks
719 streaming all changes
720 1090 files to transfer, 102 KB of data (no-zstd !)
721 transferred 102 KB in * seconds (* */sec) (glob) (no-zstd !)
722 1090 files to transfer, 98.8 KB of data (zstd !)
723 transferred 98.8 KB in * seconds (* */sec) (glob) (zstd !)
724 searching for changes
725 no changes found
726 updating to branch default
727 1088 files updated, 0 files merged, 0 files removed, 0 files unresolved
728 #endif
729 #if stream-bundle2
730 $ hg clone --stream http://localhost:$HGPORT with-bookmarks
731 streaming all changes
732 1096 files to transfer, 102 KB of data (no-zstd !)
733 transferred 102 KB in * seconds (* */sec) (glob) (no-zstd !)
734 1096 files to transfer, 99.1 KB of data (zstd !)
735 transferred 99.1 KB in * seconds (* */sec) (glob) (zstd !)
736 updating to branch default
737 1088 files updated, 0 files merged, 0 files removed, 0 files unresolved
738 #endif
739 $ hg verify -R with-bookmarks
740 checking changesets
741 checking manifests
742 crosschecking files in changesets and manifests
743 checking files
744 checked 3 changesets with 1088 changes to 1088 files
745 $ hg -R with-bookmarks bookmarks
746 some-bookmark 2:5223b5e3265f
747
748 Stream repository with phases
749 -----------------------------
750
751 Clone as publishing
752
753 $ hg -R server phase -r 'all()'
754 0: draft
755 1: draft
756 2: draft
757
758 #if stream-legacy
759 $ hg clone --stream http://localhost:$HGPORT phase-publish
760 streaming all changes
761 1090 files to transfer, 102 KB of data (no-zstd !)
762 transferred 102 KB in * seconds (* */sec) (glob) (no-zstd !)
763 1090 files to transfer, 98.8 KB of data (zstd !)
764 transferred 98.8 KB in * seconds (* */sec) (glob) (zstd !)
765 searching for changes
766 no changes found
767 updating to branch default
768 1088 files updated, 0 files merged, 0 files removed, 0 files unresolved
769 #endif
770 #if stream-bundle2
771 $ hg clone --stream http://localhost:$HGPORT phase-publish
772 streaming all changes
773 1096 files to transfer, 102 KB of data (no-zstd !)
774 transferred 102 KB in * seconds (* */sec) (glob) (no-zstd !)
775 1096 files to transfer, 99.1 KB of data (zstd !)
776 transferred 99.1 KB in * seconds (* */sec) (glob) (zstd !)
777 updating to branch default
778 1088 files updated, 0 files merged, 0 files removed, 0 files unresolved
779 #endif
780 $ hg verify -R phase-publish
781 checking changesets
782 checking manifests
783 crosschecking files in changesets and manifests
784 checking files
785 checked 3 changesets with 1088 changes to 1088 files
786 $ hg -R phase-publish phase -r 'all()'
787 0: public
788 1: public
789 2: public
790
791 Clone as non publishing
792
793 $ cat << EOF >> server/.hg/hgrc
794 > [phases]
795 > publish = False
796 > EOF
797 $ killdaemons.py
798 $ hg -R server serve -p $HGPORT -d --pid-file=hg.pid
799 $ cat hg.pid > $DAEMON_PIDS
800
801 #if stream-legacy
802
803 With v1 of the stream protocol, changeset are always cloned as public. It make
804 stream v1 unsuitable for non-publishing repository.
805
806 $ hg clone --stream http://localhost:$HGPORT phase-no-publish
807 streaming all changes
808 1090 files to transfer, 102 KB of data (no-zstd !)
809 transferred 102 KB in * seconds (* */sec) (glob) (no-zstd !)
810 1090 files to transfer, 98.8 KB of data (zstd !)
811 transferred 98.8 KB in * seconds (* */sec) (glob) (zstd !)
812 searching for changes
813 no changes found
814 updating to branch default
815 1088 files updated, 0 files merged, 0 files removed, 0 files unresolved
816 $ hg -R phase-no-publish phase -r 'all()'
817 0: public
818 1: public
819 2: public
820 #endif
821 #if stream-bundle2
822 $ hg clone --stream http://localhost:$HGPORT phase-no-publish
823 streaming all changes
824 1097 files to transfer, 102 KB of data (no-zstd !)
825 transferred 102 KB in * seconds (* */sec) (glob) (no-zstd !)
826 1097 files to transfer, 99.1 KB of data (zstd !)
827 transferred 99.1 KB in * seconds (* */sec) (glob) (zstd !)
828 updating to branch default
829 1088 files updated, 0 files merged, 0 files removed, 0 files unresolved
830 $ hg -R phase-no-publish phase -r 'all()'
831 0: draft
832 1: draft
833 2: draft
834 #endif
835 $ hg verify -R phase-no-publish
836 checking changesets
837 checking manifests
838 crosschecking files in changesets and manifests
839 checking files
840 checked 3 changesets with 1088 changes to 1088 files
841
842 $ killdaemons.py
843
844 #if stream-legacy
845
846 With v1 of the stream protocol, changeset are always cloned as public. There's
847 no obsolescence markers exchange in stream v1.
848
849 #endif
850 #if stream-bundle2
851
852 Stream repository with obsolescence
853 -----------------------------------
854
855 Clone non-publishing with obsolescence
856
857 $ cat >> $HGRCPATH << EOF
858 > [experimental]
859 > evolution=all
860 > EOF
861
862 $ cd server
863 $ echo foo > foo
864 $ hg -q commit -m 'about to be pruned'
865 $ hg debugobsolete `hg log -r . -T '{node}'` -d '0 0' -u test --record-parents
866 1 new obsolescence markers
867 obsoleted 1 changesets
868 $ hg up null -q
869 $ hg log -T '{rev}: {phase}\n'
870 2: draft
871 1: draft
872 0: draft
873 $ hg serve -p $HGPORT -d --pid-file=hg.pid
874 $ cat hg.pid > $DAEMON_PIDS
875 $ cd ..
876
877 $ hg clone -U --stream http://localhost:$HGPORT with-obsolescence
878 streaming all changes
879 1098 files to transfer, 102 KB of data (no-zstd !)
880 transferred 102 KB in * seconds (* */sec) (glob) (no-zstd !)
881 1098 files to transfer, 99.5 KB of data (zstd !)
882 transferred 99.5 KB in * seconds (* */sec) (glob) (zstd !)
883 $ hg -R with-obsolescence log -T '{rev}: {phase}\n'
884 2: draft
885 1: draft
886 0: draft
887 $ hg debugobsolete -R with-obsolescence
888 8c206a663911c1f97f2f9d7382e417ae55872cfa 0 {5223b5e3265f0df40bb743da62249413d74ac70f} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
889 $ hg verify -R with-obsolescence
890 checking changesets
891 checking manifests
892 crosschecking files in changesets and manifests
893 checking files
894 checked 4 changesets with 1089 changes to 1088 files
895
896 $ hg clone -U --stream --config experimental.evolution=0 http://localhost:$HGPORT with-obsolescence-no-evolution
897 streaming all changes
898 remote: abort: server has obsolescence markers, but client cannot receive them via stream clone
899 abort: pull failed on remote
900 [100]
901
902 $ killdaemons.py
903
904 #endif