Show More
@@ -426,30 +426,6 b' class locallegacypeer(localpeer):' | |||
|
426 | 426 | # End of baselegacywirecommands interface. |
|
427 | 427 | |
|
428 | 428 | |
|
429 | # Increment the sub-version when the revlog v2 format changes to lock out old | |
|
430 | # clients. | |
|
431 | REVLOGV2_REQUIREMENT = b'exp-revlogv2.1' | |
|
432 | ||
|
433 | # A repository with the sparserevlog feature will have delta chains that | |
|
434 | # can spread over a larger span. Sparse reading cuts these large spans into | |
|
435 | # pieces, so that each piece isn't too big. | |
|
436 | # Without the sparserevlog capability, reading from the repository could use | |
|
437 | # huge amounts of memory, because the whole span would be read at once, | |
|
438 | # including all the intermediate revisions that aren't pertinent for the chain. | |
|
439 | # This is why once a repository has enabled sparse-read, it becomes required. | |
|
440 | SPARSEREVLOG_REQUIREMENT = b'sparserevlog' | |
|
441 | ||
|
442 | # A repository with the sidedataflag requirement will allow to store extra | |
|
443 | # information for revision without altering their original hashes. | |
|
444 | SIDEDATA_REQUIREMENT = b'exp-sidedata-flag' | |
|
445 | ||
|
446 | # A repository with the the copies-sidedata-changeset requirement will store | |
|
447 | # copies related information in changeset's sidedata. | |
|
448 | COPIESSDC_REQUIREMENT = b'exp-copies-sidedata-changeset' | |
|
449 | ||
|
450 | # The repository use persistent nodemap for the changelog and the manifest. | |
|
451 | NODEMAP_REQUIREMENT = b'persistent-nodemap' | |
|
452 | ||
|
453 | 429 | # Functions receiving (ui, features) that extensions can register to impact |
|
454 | 430 | # the ability to load repositories with custom requirements. Only |
|
455 | 431 | # functions defined in loaded extensions are called. |
@@ -863,12 +839,15 b' def resolvestorevfsoptions(ui, requireme' | |||
|
863 | 839 | # This revlog format is super old and we don't bother trying to parse |
|
864 | 840 | # opener options for it because those options wouldn't do anything |
|
865 | 841 | # meaningful on such old repos. |
|
866 | if b'revlogv1' in requirements or REVLOGV2_REQUIREMENT in requirements: | |
|
842 | if ( | |
|
843 | b'revlogv1' in requirements | |
|
844 | or requirementsmod.REVLOGV2_REQUIREMENT in requirements | |
|
845 | ): | |
|
867 | 846 | options.update(resolverevlogstorevfsoptions(ui, requirements, features)) |
|
868 | 847 | else: # explicitly mark repo as using revlogv0 |
|
869 | 848 | options[b'revlogv0'] = True |
|
870 | 849 | |
|
871 | if COPIESSDC_REQUIREMENT in requirements: | |
|
850 | if requirementsmod.COPIESSDC_REQUIREMENT in requirements: | |
|
872 | 851 | options[b'copies-storage'] = b'changeset-sidedata' |
|
873 | 852 | else: |
|
874 | 853 | writecopiesto = ui.config(b'experimental', b'copies.write-to') |
@@ -887,7 +866,7 b' def resolverevlogstorevfsoptions(ui, req' | |||
|
887 | 866 | |
|
888 | 867 | if b'revlogv1' in requirements: |
|
889 | 868 | options[b'revlogv1'] = True |
|
890 | if REVLOGV2_REQUIREMENT in requirements: | |
|
869 | if requirementsmod.REVLOGV2_REQUIREMENT in requirements: | |
|
891 | 870 | options[b'revlogv2'] = True |
|
892 | 871 | |
|
893 | 872 | if b'generaldelta' in requirements: |
@@ -931,12 +910,12 b' def resolverevlogstorevfsoptions(ui, req' | |||
|
931 | 910 | options[b'sparse-read-density-threshold'] = srdensitythres |
|
932 | 911 | options[b'sparse-read-min-gap-size'] = srmingapsize |
|
933 | 912 | |
|
934 | sparserevlog = SPARSEREVLOG_REQUIREMENT in requirements | |
|
913 | sparserevlog = requirementsmod.SPARSEREVLOG_REQUIREMENT in requirements | |
|
935 | 914 | options[b'sparse-revlog'] = sparserevlog |
|
936 | 915 | if sparserevlog: |
|
937 | 916 | options[b'generaldelta'] = True |
|
938 | 917 | |
|
939 | sidedata = SIDEDATA_REQUIREMENT in requirements | |
|
918 | sidedata = requirementsmod.SIDEDATA_REQUIREMENT in requirements | |
|
940 | 919 | options[b'side-data'] = sidedata |
|
941 | 920 | |
|
942 | 921 | maxchainlen = None |
@@ -972,7 +951,7 b' def resolverevlogstorevfsoptions(ui, req' | |||
|
972 | 951 | |
|
973 | 952 | if ui.configbool(b'experimental', b'rust.index'): |
|
974 | 953 | options[b'rust.index'] = True |
|
975 | if NODEMAP_REQUIREMENT in requirements: | |
|
954 | if requirementsmod.NODEMAP_REQUIREMENT in requirements: | |
|
976 | 955 | options[b'persistent-nodemap'] = True |
|
977 | 956 | if ui.configbool(b'storage', b'revlog.nodemap.mmap'): |
|
978 | 957 | options[b'persistent-nodemap.mmap'] = True |
@@ -1058,11 +1037,11 b' class localrepository(object):' | |||
|
1058 | 1037 | b'revlogv1', |
|
1059 | 1038 | b'generaldelta', |
|
1060 | 1039 | requirementsmod.TREEMANIFEST_REQUIREMENT, |
|
1061 | COPIESSDC_REQUIREMENT, | |
|
1062 | REVLOGV2_REQUIREMENT, | |
|
1063 | SIDEDATA_REQUIREMENT, | |
|
1064 | SPARSEREVLOG_REQUIREMENT, | |
|
1065 | NODEMAP_REQUIREMENT, | |
|
1040 | requirementsmod.COPIESSDC_REQUIREMENT, | |
|
1041 | requirementsmod.REVLOGV2_REQUIREMENT, | |
|
1042 | requirementsmod.SIDEDATA_REQUIREMENT, | |
|
1043 | requirementsmod.SPARSEREVLOG_REQUIREMENT, | |
|
1044 | requirementsmod.NODEMAP_REQUIREMENT, | |
|
1066 | 1045 | bookmarks.BOOKMARKS_IN_STORE_REQUIREMENT, |
|
1067 | 1046 | } |
|
1068 | 1047 | _basesupported = supportedformats | { |
@@ -1241,7 +1220,7 b' class localrepository(object):' | |||
|
1241 | 1220 | self._extrafilterid = repoview.extrafilter(ui) |
|
1242 | 1221 | |
|
1243 | 1222 | self.filecopiesmode = None |
|
1244 | if COPIESSDC_REQUIREMENT in self.requirements: | |
|
1223 | if requirementsmod.COPIESSDC_REQUIREMENT in self.requirements: | |
|
1245 | 1224 | self.filecopiesmode = b'changeset-sidedata' |
|
1246 | 1225 | |
|
1247 | 1226 | def _getvfsward(self, origfunc): |
@@ -3308,15 +3287,15 b' def newreporequirements(ui, createopts):' | |||
|
3308 | 3287 | if scmutil.gdinitconfig(ui): |
|
3309 | 3288 | requirements.add(b'generaldelta') |
|
3310 | 3289 | if ui.configbool(b'format', b'sparse-revlog'): |
|
3311 | requirements.add(SPARSEREVLOG_REQUIREMENT) | |
|
3290 | requirements.add(requirementsmod.SPARSEREVLOG_REQUIREMENT) | |
|
3312 | 3291 | |
|
3313 | 3292 | # experimental config: format.exp-use-side-data |
|
3314 | 3293 | if ui.configbool(b'format', b'exp-use-side-data'): |
|
3315 | requirements.add(SIDEDATA_REQUIREMENT) | |
|
3294 | requirements.add(requirementsmod.SIDEDATA_REQUIREMENT) | |
|
3316 | 3295 | # experimental config: format.exp-use-copies-side-data-changeset |
|
3317 | 3296 | if ui.configbool(b'format', b'exp-use-copies-side-data-changeset'): |
|
3318 | requirements.add(SIDEDATA_REQUIREMENT) | |
|
3319 | requirements.add(COPIESSDC_REQUIREMENT) | |
|
3297 | requirements.add(requirementsmod.SIDEDATA_REQUIREMENT) | |
|
3298 | requirements.add(requirementsmod.COPIESSDC_REQUIREMENT) | |
|
3320 | 3299 | if ui.configbool(b'experimental', b'treemanifest'): |
|
3321 | 3300 | requirements.add(requirementsmod.TREEMANIFEST_REQUIREMENT) |
|
3322 | 3301 | |
@@ -3325,7 +3304,7 b' def newreporequirements(ui, createopts):' | |||
|
3325 | 3304 | requirements.remove(b'revlogv1') |
|
3326 | 3305 | # generaldelta is implied by revlogv2. |
|
3327 | 3306 | requirements.discard(b'generaldelta') |
|
3328 | requirements.add(REVLOGV2_REQUIREMENT) | |
|
3307 | requirements.add(requirementsmod.REVLOGV2_REQUIREMENT) | |
|
3329 | 3308 | # experimental config: format.internal-phase |
|
3330 | 3309 | if ui.configbool(b'format', b'internal-phase'): |
|
3331 | 3310 | requirements.add(requirementsmod.INTERNAL_PHASE_REQUIREMENT) |
@@ -3340,7 +3319,7 b' def newreporequirements(ui, createopts):' | |||
|
3340 | 3319 | requirements.add(bookmarks.BOOKMARKS_IN_STORE_REQUIREMENT) |
|
3341 | 3320 | |
|
3342 | 3321 | if ui.configbool(b'format', b'use-persistent-nodemap'): |
|
3343 | requirements.add(NODEMAP_REQUIREMENT) | |
|
3322 | requirements.add(requirementsmod.NODEMAP_REQUIREMENT) | |
|
3344 | 3323 | |
|
3345 | 3324 | return requirements |
|
3346 | 3325 |
@@ -20,3 +20,27 b" INTERNAL_PHASE_REQUIREMENT = b'internal-" | |||
|
20 | 20 | |
|
21 | 21 | # Stores manifest in Tree structure |
|
22 | 22 | TREEMANIFEST_REQUIREMENT = b'treemanifest' |
|
23 | ||
|
24 | # Increment the sub-version when the revlog v2 format changes to lock out old | |
|
25 | # clients. | |
|
26 | REVLOGV2_REQUIREMENT = b'exp-revlogv2.1' | |
|
27 | ||
|
28 | # A repository with the sparserevlog feature will have delta chains that | |
|
29 | # can spread over a larger span. Sparse reading cuts these large spans into | |
|
30 | # pieces, so that each piece isn't too big. | |
|
31 | # Without the sparserevlog capability, reading from the repository could use | |
|
32 | # huge amounts of memory, because the whole span would be read at once, | |
|
33 | # including all the intermediate revisions that aren't pertinent for the chain. | |
|
34 | # This is why once a repository has enabled sparse-read, it becomes required. | |
|
35 | SPARSEREVLOG_REQUIREMENT = b'sparserevlog' | |
|
36 | ||
|
37 | # A repository with the sidedataflag requirement will allow to store extra | |
|
38 | # information for revision without altering their original hashes. | |
|
39 | SIDEDATA_REQUIREMENT = b'exp-sidedata-flag' | |
|
40 | ||
|
41 | # A repository with the the copies-sidedata-changeset requirement will store | |
|
42 | # copies related information in changeset's sidedata. | |
|
43 | COPIESSDC_REQUIREMENT = b'exp-copies-sidedata-changeset' | |
|
44 | ||
|
45 | # The repository use persistent nodemap for the changelog and the manifest. | |
|
46 | NODEMAP_REQUIREMENT = b'persistent-nodemap' |
@@ -32,7 +32,7 b' from .utils import compression' | |||
|
32 | 32 | # list of requirements that request a clone of all revlog if added/removed |
|
33 | 33 | RECLONES_REQUIREMENTS = { |
|
34 | 34 | b'generaldelta', |
|
35 |
|
|
|
35 | requirements.SPARSEREVLOG_REQUIREMENT, | |
|
36 | 36 | } |
|
37 | 37 | |
|
38 | 38 | |
@@ -76,10 +76,10 b' def supportremovedrequirements(repo):' | |||
|
76 | 76 | to be allowed. |
|
77 | 77 | """ |
|
78 | 78 | supported = { |
|
79 |
|
|
|
80 |
|
|
|
81 |
|
|
|
82 |
|
|
|
79 | requirements.SPARSEREVLOG_REQUIREMENT, | |
|
80 | requirements.SIDEDATA_REQUIREMENT, | |
|
81 | requirements.COPIESSDC_REQUIREMENT, | |
|
82 | requirements.NODEMAP_REQUIREMENT, | |
|
83 | 83 | } |
|
84 | 84 | for name in compression.compengines: |
|
85 | 85 | engine = compression.compengines[name] |
@@ -104,10 +104,10 b' def supporteddestrequirements(repo):' | |||
|
104 | 104 | b'generaldelta', |
|
105 | 105 | b'revlogv1', |
|
106 | 106 | b'store', |
|
107 |
|
|
|
108 |
|
|
|
109 |
|
|
|
110 |
|
|
|
107 | requirements.SPARSEREVLOG_REQUIREMENT, | |
|
108 | requirements.SIDEDATA_REQUIREMENT, | |
|
109 | requirements.COPIESSDC_REQUIREMENT, | |
|
110 | requirements.NODEMAP_REQUIREMENT, | |
|
111 | 111 | } |
|
112 | 112 | for name in compression.compengines: |
|
113 | 113 | engine = compression.compengines[name] |
@@ -132,10 +132,10 b' def allowednewrequirements(repo):' | |||
|
132 | 132 | b'dotencode', |
|
133 | 133 | b'fncache', |
|
134 | 134 | b'generaldelta', |
|
135 |
|
|
|
136 |
|
|
|
137 |
|
|
|
138 |
|
|
|
135 | requirements.SPARSEREVLOG_REQUIREMENT, | |
|
136 | requirements.SIDEDATA_REQUIREMENT, | |
|
137 | requirements.COPIESSDC_REQUIREMENT, | |
|
138 | requirements.NODEMAP_REQUIREMENT, | |
|
139 | 139 | } |
|
140 | 140 | for name in compression.compengines: |
|
141 | 141 | engine = compression.compengines[name] |
@@ -339,7 +339,7 b' class generaldelta(requirementformatvari' | |||
|
339 | 339 | class sparserevlog(requirementformatvariant): |
|
340 | 340 | name = b'sparserevlog' |
|
341 | 341 | |
|
342 |
_requirement = |
|
|
342 | _requirement = requirements.SPARSEREVLOG_REQUIREMENT | |
|
343 | 343 | |
|
344 | 344 | default = True |
|
345 | 345 | |
@@ -365,7 +365,7 b' class sparserevlog(requirementformatvari' | |||
|
365 | 365 | class sidedata(requirementformatvariant): |
|
366 | 366 | name = b'sidedata' |
|
367 | 367 | |
|
368 |
_requirement = |
|
|
368 | _requirement = requirements.SIDEDATA_REQUIREMENT | |
|
369 | 369 | |
|
370 | 370 | default = False |
|
371 | 371 | |
@@ -381,7 +381,7 b' class sidedata(requirementformatvariant)' | |||
|
381 | 381 | class persistentnodemap(requirementformatvariant): |
|
382 | 382 | name = b'persistent-nodemap' |
|
383 | 383 | |
|
384 |
_requirement = |
|
|
384 | _requirement = requirements.NODEMAP_REQUIREMENT | |
|
385 | 385 | |
|
386 | 386 | default = False |
|
387 | 387 | |
@@ -396,7 +396,7 b' class persistentnodemap(requirementforma' | |||
|
396 | 396 | class copiessdc(requirementformatvariant): |
|
397 | 397 | name = b'copies-sdc' |
|
398 | 398 | |
|
399 |
_requirement = |
|
|
399 | _requirement = requirements.COPIESSDC_REQUIREMENT | |
|
400 | 400 | |
|
401 | 401 | default = False |
|
402 | 402 | |
@@ -726,7 +726,7 b' def getsidedatacompanion(srcrepo, dstrep' | |||
|
726 | 726 | sidedatacompanion = None |
|
727 | 727 | removedreqs = srcrepo.requirements - dstrepo.requirements |
|
728 | 728 | addedreqs = dstrepo.requirements - srcrepo.requirements |
|
729 |
if |
|
|
729 | if requirements.SIDEDATA_REQUIREMENT in removedreqs: | |
|
730 | 730 | |
|
731 | 731 | def sidedatacompanion(rl, rev): |
|
732 | 732 | rl = getattr(rl, '_revlog', rl) |
@@ -734,9 +734,9 b' def getsidedatacompanion(srcrepo, dstrep' | |||
|
734 | 734 | return True, (), {} |
|
735 | 735 | return False, (), {} |
|
736 | 736 | |
|
737 |
elif |
|
|
737 | elif requirements.COPIESSDC_REQUIREMENT in addedreqs: | |
|
738 | 738 | sidedatacompanion = metadata.getsidedataadder(srcrepo, dstrepo) |
|
739 |
elif |
|
|
739 | elif requirements.COPIESSDC_REQUIREMENT in removedreqs: | |
|
740 | 740 | sidedatacompanion = metadata.getsidedataremover(srcrepo, dstrepo) |
|
741 | 741 | return sidedatacompanion |
|
742 | 742 |
@@ -12,8 +12,8 b' import struct' | |||
|
12 | 12 | |
|
13 | 13 | from mercurial import ( |
|
14 | 14 | extensions, |
|
15 | localrepo, | |
|
16 | 15 | node, |
|
16 | requirements, | |
|
17 | 17 | revlog, |
|
18 | 18 | upgrade, |
|
19 | 19 | ) |
@@ -54,7 +54,7 b' def wraprevision(orig, self, nodeorrev, ' | |||
|
54 | 54 | def wrapgetsidedatacompanion(orig, srcrepo, dstrepo): |
|
55 | 55 | sidedatacompanion = orig(srcrepo, dstrepo) |
|
56 | 56 | addedreqs = dstrepo.requirements - srcrepo.requirements |
|
57 |
if |
|
|
57 | if requirements.SIDEDATA_REQUIREMENT in addedreqs: | |
|
58 | 58 | assert sidedatacompanion is None # deal with composition later |
|
59 | 59 | |
|
60 | 60 | def sidedatacompanion(revlog, rev): |
General Comments 0
You need to be logged in to leave comments.
Login now