##// END OF EJS Templates
stream-clone: allow to change persistent-nodemap format during stream clone...
marmoute -
r49542:de3ac3d2 default
parent child Browse files
Show More
@@ -113,7 +113,6 b' STREAM_FIXED_REQUIREMENTS = {'
113 COPIESSDC_REQUIREMENT,
113 COPIESSDC_REQUIREMENT,
114 GENERALDELTA_REQUIREMENT,
114 GENERALDELTA_REQUIREMENT,
115 INTERNAL_PHASE_REQUIREMENT,
115 INTERNAL_PHASE_REQUIREMENT,
116 NODEMAP_REQUIREMENT,
117 REVLOG_COMPRESSION_ZSTD,
116 REVLOG_COMPRESSION_ZSTD,
118 REVLOGV1_REQUIREMENT,
117 REVLOGV1_REQUIREMENT,
119 REVLOGV2_REQUIREMENT,
118 REVLOGV2_REQUIREMENT,
@@ -16,6 +16,7 b' from ..node import hex'
16
16
17 from .. import (
17 from .. import (
18 error,
18 error,
19 requirements,
19 util,
20 util,
20 )
21 )
21 from . import docket as docket_mod
22 from . import docket as docket_mod
@@ -34,6 +35,19 b' def test_race_hook_1():'
34 pass
35 pass
35
36
36
37
38 def post_stream_cleanup(repo):
39 """The stream clone might needs to remove some file if persisten nodemap
40 was dropped while stream cloning
41 """
42 if requirements.REVLOGV1_REQUIREMENT not in repo.requirements:
43 return
44 if requirements.NODEMAP_REQUIREMENT in repo.requirements:
45 return
46 unfi = repo.unfiltered()
47 delete_nodemap(None, unfi, unfi.changelog)
48 delete_nodemap(None, repo, unfi.manifestlog._rootstore._revlog)
49
50
37 def persisted_data(revlog):
51 def persisted_data(revlog):
38 """read the nodemap for a revlog from disk"""
52 """read the nodemap for a revlog from disk"""
39 if revlog._nodemap_file is None:
53 if revlog._nodemap_file is None:
@@ -27,6 +27,9 b' from . import ('
27 store,
27 store,
28 util,
28 util,
29 )
29 )
30 from .revlogutils import (
31 nodemap,
32 )
30 from .utils import (
33 from .utils import (
31 stringutil,
34 stringutil,
32 )
35 )
@@ -216,6 +219,7 b' def maybeperformlegacystreamclone(pullop'
216 repo.ui, repo.requirements, repo.features
219 repo.ui, repo.requirements, repo.features
217 )
220 )
218 scmutil.writereporequirements(repo)
221 scmutil.writereporequirements(repo)
222 nodemap.post_stream_cleanup(repo)
219
223
220 if rbranchmap:
224 if rbranchmap:
221 repo._branchcaches.replace(repo, rbranchmap)
225 repo._branchcaches.replace(repo, rbranchmap)
@@ -510,6 +514,7 b' def applybundlev1(repo, fp):'
510 )
514 )
511
515
512 consumev1(repo, fp, filecount, bytecount)
516 consumev1(repo, fp, filecount, bytecount)
517 nodemap.post_stream_cleanup(repo)
513
518
514
519
515 class streamcloneapplier(object):
520 class streamcloneapplier(object):
@@ -826,6 +831,7 b' def applybundlev2(repo, fp, filecount, f'
826 repo.ui, repo.requirements, repo.features
831 repo.ui, repo.requirements, repo.features
827 )
832 )
828 scmutil.writereporequirements(repo)
833 scmutil.writereporequirements(repo)
834 nodemap.post_stream_cleanup(repo)
829
835
830
836
831 def _copy_files(src_vfs_map, dst_vfs_map, entries, progress):
837 def _copy_files(src_vfs_map, dst_vfs_map, entries, progress):
@@ -297,16 +297,16 b' packed1 is produced properly'
297
297
298 $ hg -R test debugcreatestreamclonebundle packed.hg
298 $ hg -R test debugcreatestreamclonebundle packed.hg
299 writing 2665 bytes for 6 files
299 writing 2665 bytes for 6 files
300 bundle requirements: generaldelta, persistent-nodemap, revlog-compression-zstd, revlogv1, sparserevlog
300 bundle requirements: generaldelta, revlog-compression-zstd, revlogv1, sparserevlog
301
301
302 $ f -B 64 --size --sha1 --hexdump packed.hg
302 $ f -B 64 --size --sha1 --hexdump packed.hg
303 packed.hg: size=2884, sha1=b0c868701f8a9fe44daf094b2f5bf661cf90c789
303 packed.hg: size=2865, sha1=353d10311f4befa195d9a1ca4b8e26518115c702
304 0000: 48 47 53 31 55 4e 00 00 00 00 00 00 00 06 00 00 |HGS1UN..........|
304 0000: 48 47 53 31 55 4e 00 00 00 00 00 00 00 06 00 00 |HGS1UN..........|
305 0010: 00 00 00 00 0a 69 00 4e 67 65 6e 65 72 61 6c 64 |.....i.Ngenerald|
305 0010: 00 00 00 00 0a 69 00 3b 67 65 6e 65 72 61 6c 64 |.....i.;generald|
306 0020: 65 6c 74 61 2c 70 65 72 73 69 73 74 65 6e 74 2d |elta,persistent-|
306 0020: 65 6c 74 61 2c 72 65 76 6c 6f 67 2d 63 6f 6d 70 |elta,revlog-comp|
307 0030: 6e 6f 64 65 6d 61 70 2c 72 65 76 6c 6f 67 2d 63 |nodemap,revlog-c|
307 0030: 72 65 73 73 69 6f 6e 2d 7a 73 74 64 2c 72 65 76 |ression-zstd,rev|
308 $ hg debugbundle --spec packed.hg
308 $ hg debugbundle --spec packed.hg
309 none-packed1;requirements%3Dgeneraldelta%2Cpersistent-nodemap%2Crevlog-compression-zstd%2Crevlogv1%2Csparserevlog
309 none-packed1;requirements%3Dgeneraldelta%2Crevlog-compression-zstd%2Crevlogv1%2Csparserevlog
310 #endif
310 #endif
311
311
312 #if reporevlogstore no-rust zstd
312 #if reporevlogstore no-rust zstd
@@ -357,17 +357,17 b' generaldelta requirement is not listed i'
357
357
358 $ hg -R testnongd debugcreatestreamclonebundle packednongd.hg
358 $ hg -R testnongd debugcreatestreamclonebundle packednongd.hg
359 writing 301 bytes for 3 files
359 writing 301 bytes for 3 files
360 bundle requirements: persistent-nodemap, revlog-compression-zstd, revlogv1
360 bundle requirements: revlog-compression-zstd, revlogv1
361
361
362 $ f -B 64 --size --sha1 --hexdump packednongd.hg
362 $ f -B 64 --size --sha1 --hexdump packednongd.hg
363 packednongd.hg: size=426, sha1=79563ccd6ef779bcfe62a4da64f89a1b308e92e0
363 packednongd.hg: size=407, sha1=0b8714422b785ba8eb98c916b41ffd5fb994c9b5
364 0000: 48 47 53 31 55 4e 00 00 00 00 00 00 00 03 00 00 |HGS1UN..........|
364 0000: 48 47 53 31 55 4e 00 00 00 00 00 00 00 03 00 00 |HGS1UN..........|
365 0010: 00 00 00 00 01 2d 00 34 70 65 72 73 69 73 74 65 |.....-.4persiste|
365 0010: 00 00 00 00 01 2d 00 21 72 65 76 6c 6f 67 2d 63 |.....-.!revlog-c|
366 0020: 6e 74 2d 6e 6f 64 65 6d 61 70 2c 72 65 76 6c 6f |nt-nodemap,revlo|
366 0020: 6f 6d 70 72 65 73 73 69 6f 6e 2d 7a 73 74 64 2c |ompression-zstd,|
367 0030: 67 2d 63 6f 6d 70 72 65 73 73 69 6f 6e 2d 7a 73 |g-compression-zs|
367 0030: 72 65 76 6c 6f 67 76 31 00 64 61 74 61 2f 66 6f |revlogv1.data/fo|
368
368
369 $ hg debugbundle --spec packednongd.hg
369 $ hg debugbundle --spec packednongd.hg
370 none-packed1;requirements%3Dpersistent-nodemap%2Crevlog-compression-zstd%2Crevlogv1
370 none-packed1;requirements%3Drevlog-compression-zstd%2Crevlogv1
371
371
372 #endif
372 #endif
373
373
@@ -427,7 +427,7 b' Warning emitted when packed bundles cont'
427 $ hg -R testsecret debugcreatestreamclonebundle packedsecret.hg
427 $ hg -R testsecret debugcreatestreamclonebundle packedsecret.hg
428 (warning: stream clone bundle will contain secret revisions)
428 (warning: stream clone bundle will contain secret revisions)
429 writing 301 bytes for 3 files
429 writing 301 bytes for 3 files
430 bundle requirements: generaldelta, persistent-nodemap, revlog-compression-zstd, revlogv1, sparserevlog
430 bundle requirements: generaldelta, revlog-compression-zstd, revlogv1, sparserevlog
431
431
432 #endif
432 #endif
433
433
@@ -4,6 +4,11 b' This file contains tests case that deal '
4
4
5 #testcases stream-legacy stream-bundle2
5 #testcases stream-legacy stream-bundle2
6
6
7 $ cat << EOF >> $HGRCPATH
8 > [storage]
9 > revlog.persistent-nodemap.slow-path=allow
10 > EOF
11
7 #if stream-legacy
12 #if stream-legacy
8 $ cat << EOF >> $HGRCPATH
13 $ cat << EOF >> $HGRCPATH
9 > [server]
14 > [server]
@@ -13,7 +18,7 b' This file contains tests case that deal '
13
18
14 Initialize repository
19 Initialize repository
15
20
16 $ hg init server --config format.use-share-safe=yes
21 $ hg init server --config format.use-share-safe=yes --config format.use-persistent-nodemap=yes
17 $ cd server
22 $ cd server
18 $ sh $TESTDIR/testlib/stream_clone_setup.sh
23 $ sh $TESTDIR/testlib/stream_clone_setup.sh
19 adding 00changelog-ab349180a0405010.nd
24 adding 00changelog-ab349180a0405010.nd
@@ -345,3 +350,86 b' no-share-safe \xe2\x86\x92 share-safe cloning'
345
350
346
351
347 $ killdaemons.py
352 $ killdaemons.py
353
354
355 Test streaming from/to repository without a persistent-nodemap
356 ==============================================================
357
358 persistent nodemap affects revlog, but they are easy to generate locally, so we allow it to be changed over a stream clone
359
360 $ rm hg-*.pid errors-*.txt
361 $ hg clone --pull --config format.use-persistent-nodemap=no server server-no-persistent-nodemap
362 requesting all changes
363 adding changesets
364 adding manifests
365 adding file changes
366 added 5004 changesets with 1088 changes to 1088 files (+1 heads)
367 new changesets 96ee1d7354c4:06ddac466af5
368 updating to branch default
369 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
370 $ hg verify -R server-no-persistent-nodemap
371 checking changesets
372 checking manifests
373 crosschecking files in changesets and manifests
374 checking files
375 checked 5004 changesets with 1088 changes to 1088 files
376 $ hg -R server serve -p $HGPORT -d --pid-file=hg-1.pid --error errors-1.txt
377 $ cat hg-1.pid > $DAEMON_PIDS
378 $ hg -R server-no-persistent-nodemap serve -p $HGPORT2 -d --pid-file=hg-2.pid --error errors-2.txt
379 $ cat hg-2.pid >> $DAEMON_PIDS
380 $ hg debugrequires -R server | grep persistent-nodemap
381 persistent-nodemap
382 $ hg debugrequires -R server-no-persistent-nodemap | grep persistent-nodemap
383 [1]
384 $ ls -1 server/.hg/store/00changelog*
385 server/.hg/store/00changelog-*.nd (glob)
386 server/.hg/store/00changelog.d
387 server/.hg/store/00changelog.i
388 server/.hg/store/00changelog.n
389 $ ls -1 server-no-persistent-nodemap/.hg/store/00changelog*
390 server-no-persistent-nodemap/.hg/store/00changelog.d
391 server-no-persistent-nodemap/.hg/store/00changelog.i
392
393 persistent-nodemap no-persistent-nodemap cloning
394
395 $ hg clone --quiet --stream -U http://localhost:$HGPORT clone-remove-persistent-nodemap --config format.use-persistent-nodemap=no
396 $ cat errors-1.txt
397 $ hg -R clone-remove-persistent-nodemap verify
398 checking changesets
399 checking manifests
400 crosschecking files in changesets and manifests
401 checking files
402 checked 5004 changesets with 1088 changes to 1088 files
403 $ hg debugrequires -R clone-remove-persistent-nodemap | grep persistent-nodemap
404 [1]
405
406 The persistent-nodemap files should no longer exists
407
408 $ ls -1 clone-remove-persistent-nodemap/.hg/store/00changelog*
409 clone-remove-persistent-nodemap/.hg/store/00changelog.d
410 clone-remove-persistent-nodemap/.hg/store/00changelog.i
411
412
413 no-persistent-nodemap persistent-nodemap cloning
414
415 $ hg clone --quiet --stream -U http://localhost:$HGPORT2 clone-add-persistent-nodemap --config format.use-persistent-nodemap=yes
416 $ cat errors-2.txt
417 $ hg -R clone-add-persistent-nodemap verify
418 checking changesets
419 checking manifests
420 crosschecking files in changesets and manifests
421 checking files
422 checked 5004 changesets with 1088 changes to 1088 files
423 $ hg debugrequires -R clone-add-persistent-nodemap | grep persistent-nodemap
424 persistent-nodemap
425
426 The persistent-nodemap files should exists
427
428 $ ls -1 clone-add-persistent-nodemap/.hg/store/00changelog*
429 clone-add-persistent-nodemap/.hg/store/00changelog-*.nd (glob)
430 clone-add-persistent-nodemap/.hg/store/00changelog.d
431 clone-add-persistent-nodemap/.hg/store/00changelog.i
432 clone-add-persistent-nodemap/.hg/store/00changelog.n
433
434
435 $ killdaemons.py
@@ -338,23 +338,23 b' getbundle requests with stream=1 are unc'
338 #endif
338 #endif
339 #if zstd rust no-dirstate-v2
339 #if zstd rust no-dirstate-v2
340 $ f --size --hex --bytes 256 body
340 $ f --size --hex --bytes 256 body
341 body: size=116331
341 body: size=116310
342 0000: 04 6e 6f 6e 65 48 47 32 30 00 00 00 00 00 00 00 |.noneHG20.......|
342 0000: 04 6e 6f 6e 65 48 47 32 30 00 00 00 00 00 00 00 |.noneHG20.......|
343 0010: 91 07 53 54 52 45 41 4d 32 00 00 00 00 03 00 09 |..STREAM2.......|
343 0010: 7c 07 53 54 52 45 41 4d 32 00 00 00 00 03 00 09 ||.STREAM2.......|
344 0020: 06 09 04 0c 55 62 79 74 65 63 6f 75 6e 74 31 30 |....Ubytecount10|
344 0020: 06 09 04 0c 40 62 79 74 65 63 6f 75 6e 74 31 30 |....@bytecount10|
345 0030: 31 32 37 36 66 69 6c 65 63 6f 75 6e 74 31 30 39 |1276filecount109|
345 0030: 31 32 37 36 66 69 6c 65 63 6f 75 6e 74 31 30 39 |1276filecount109|
346 0040: 33 72 65 71 75 69 72 65 6d 65 6e 74 73 67 65 6e |3requirementsgen|
346 0040: 33 72 65 71 75 69 72 65 6d 65 6e 74 73 67 65 6e |3requirementsgen|
347 0050: 65 72 61 6c 64 65 6c 74 61 25 32 43 70 65 72 73 |eraldelta%2Cpers|
347 0050: 65 72 61 6c 64 65 6c 74 61 25 32 43 72 65 76 6c |eraldelta%2Crevl|
348 0060: 69 73 74 65 6e 74 2d 6e 6f 64 65 6d 61 70 25 32 |istent-nodemap%2|
348 0060: 6f 67 2d 63 6f 6d 70 72 65 73 73 69 6f 6e 2d 7a |og-compression-z|
349 0070: 43 72 65 76 6c 6f 67 2d 63 6f 6d 70 72 65 73 73 |Crevlog-compress|
349 0070: 73 74 64 25 32 43 72 65 76 6c 6f 67 76 31 25 32 |std%2Crevlogv1%2|
350 0080: 69 6f 6e 2d 7a 73 74 64 25 32 43 72 65 76 6c 6f |ion-zstd%2Crevlo|
350 0080: 43 73 70 61 72 73 65 72 65 76 6c 6f 67 00 00 80 |Csparserevlog...|
351 0090: 67 76 31 25 32 43 73 70 61 72 73 65 72 65 76 6c |gv1%2Csparserevl|
351 0090: 00 73 08 42 64 61 74 61 2f 30 2e 69 00 03 00 01 |.s.Bdata/0.i....|
352 00a0: 6f 67 00 00 80 00 73 08 42 64 61 74 61 2f 30 2e |og....s.Bdata/0.|
352 00a0: 00 00 00 00 00 00 00 02 00 00 00 01 00 00 00 00 |................|
353 00b0: 69 00 03 00 01 00 00 00 00 00 00 00 02 00 00 00 |i...............|
353 00b0: 00 00 00 01 ff ff ff ff ff ff ff ff 80 29 63 a0 |.............)c.|
354 00c0: 01 00 00 00 00 00 00 00 01 ff ff ff ff ff ff ff |................|
354 00c0: 49 d3 23 87 bf ce fe 56 67 92 67 2c 69 d1 ec 39 |I.#....Vg.g,i..9|
355 00d0: ff 80 29 63 a0 49 d3 23 87 bf ce fe 56 67 92 67 |..)c.I.#....Vg.g|
355 00d0: 00 00 00 00 00 00 00 00 00 00 00 00 75 30 73 26 |............u0s&|
356 00e0: 2c 69 d1 ec 39 00 00 00 00 00 00 00 00 00 00 00 |,i..9...........|
356 00e0: 45 64 61 74 61 2f 30 30 63 68 61 6e 67 65 6c 6f |Edata/00changelo|
357 00f0: 00 75 30 73 26 45 64 61 74 61 2f 30 30 63 68 61 |.u0s&Edata/00cha|
357 00f0: 67 2d 61 62 33 34 39 31 38 30 61 30 34 30 35 30 |g-ab349180a04050|
358 #endif
358 #endif
359 #if zstd dirstate-v2
359 #if zstd dirstate-v2
360 $ f --size --hex --bytes 256 body
360 $ f --size --hex --bytes 256 body
@@ -281,7 +281,7 b' Stream clone bundles are supported'
281 writing 613 bytes for 4 files
281 writing 613 bytes for 4 files
282 bundle requirements: generaldelta, revlogv1, sparserevlog (no-rust no-zstd !)
282 bundle requirements: generaldelta, revlogv1, sparserevlog (no-rust no-zstd !)
283 bundle requirements: generaldelta, revlog-compression-zstd, revlogv1, sparserevlog (no-rust zstd !)
283 bundle requirements: generaldelta, revlog-compression-zstd, revlogv1, sparserevlog (no-rust zstd !)
284 bundle requirements: generaldelta, persistent-nodemap, revlog-compression-zstd, revlogv1, sparserevlog (rust !)
284 bundle requirements: generaldelta, revlog-compression-zstd, revlogv1, sparserevlog (rust !)
285
285
286 No bundle spec should work
286 No bundle spec should work
287
287
@@ -657,8 +657,8 b' Test debugpeer'
657 devel-peer-request: pairs: 81 bytes
657 devel-peer-request: pairs: 81 bytes
658 sending hello command
658 sending hello command
659 sending between command
659 sending between command
660 remote: 487
660 remote: 468
661 remote: capabilities: batch branchmap $USUAL_BUNDLE2_CAPS$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,persistent-nodemap,revlog-compression-zstd,revlogv1,sparserevlog unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash
661 remote: capabilities: batch branchmap $USUAL_BUNDLE2_CAPS$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlog-compression-zstd,revlogv1,sparserevlog unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash
662 remote: 1
662 remote: 1
663 devel-peer-request: protocaps
663 devel-peer-request: protocaps
664 devel-peer-request: caps: * bytes (glob)
664 devel-peer-request: caps: * bytes (glob)
@@ -47,11 +47,11 b' The extension requires a repo (currently'
47 Stream params: {}
47 Stream params: {}
48 stream2 -- {bytecount: 1693, filecount: 11, requirements: generaldelta%2Crevlogv1%2Csparserevlog} (mandatory: True) (no-zstd !)
48 stream2 -- {bytecount: 1693, filecount: 11, requirements: generaldelta%2Crevlogv1%2Csparserevlog} (mandatory: True) (no-zstd !)
49 stream2 -- {bytecount: 1693, filecount: 11, requirements: generaldelta%2Crevlog-compression-zstd%2Crevlogv1%2Csparserevlog} (mandatory: True) (zstd no-rust !)
49 stream2 -- {bytecount: 1693, filecount: 11, requirements: generaldelta%2Crevlog-compression-zstd%2Crevlogv1%2Csparserevlog} (mandatory: True) (zstd no-rust !)
50 stream2 -- {bytecount: 1693, filecount: 11, requirements: generaldelta%2Cpersistent-nodemap%2Crevlog-compression-zstd%2Crevlogv1%2Csparserevlog} (mandatory: True) (rust !)
50 stream2 -- {bytecount: 1693, filecount: 11, requirements: generaldelta%2Crevlog-compression-zstd%2Crevlogv1%2Csparserevlog} (mandatory: True) (rust !)
51 $ hg debugbundle --spec bundle.hg
51 $ hg debugbundle --spec bundle.hg
52 none-v2;stream=v2;requirements%3Dgeneraldelta%2Crevlogv1%2Csparserevlog (no-zstd !)
52 none-v2;stream=v2;requirements%3Dgeneraldelta%2Crevlogv1%2Csparserevlog (no-zstd !)
53 none-v2;stream=v2;requirements%3Dgeneraldelta%2Crevlog-compression-zstd%2Crevlogv1%2Csparserevlog (zstd no-rust !)
53 none-v2;stream=v2;requirements%3Dgeneraldelta%2Crevlog-compression-zstd%2Crevlogv1%2Csparserevlog (zstd no-rust !)
54 none-v2;stream=v2;requirements%3Dgeneraldelta%2Cpersistent-nodemap%2Crevlog-compression-zstd%2Crevlogv1%2Csparserevlog (rust !)
54 none-v2;stream=v2;requirements%3Dgeneraldelta%2Crevlog-compression-zstd%2Crevlogv1%2Csparserevlog (rust !)
55
55
56 Test that we can apply the bundle as a stream clone bundle
56 Test that we can apply the bundle as a stream clone bundle
57
57
General Comments 0
You need to be logged in to leave comments. Login now