Show More
@@ -426,30 +426,6 b' class locallegacypeer(localpeer):' | |||||
426 | # End of baselegacywirecommands interface. |
|
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 | # Functions receiving (ui, features) that extensions can register to impact |
|
429 | # Functions receiving (ui, features) that extensions can register to impact | |
454 | # the ability to load repositories with custom requirements. Only |
|
430 | # the ability to load repositories with custom requirements. Only | |
455 | # functions defined in loaded extensions are called. |
|
431 | # functions defined in loaded extensions are called. | |
@@ -863,12 +839,15 b' def resolvestorevfsoptions(ui, requireme' | |||||
863 | # This revlog format is super old and we don't bother trying to parse |
|
839 | # This revlog format is super old and we don't bother trying to parse | |
864 | # opener options for it because those options wouldn't do anything |
|
840 | # opener options for it because those options wouldn't do anything | |
865 | # meaningful on such old repos. |
|
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 | options.update(resolverevlogstorevfsoptions(ui, requirements, features)) |
|
846 | options.update(resolverevlogstorevfsoptions(ui, requirements, features)) | |
868 | else: # explicitly mark repo as using revlogv0 |
|
847 | else: # explicitly mark repo as using revlogv0 | |
869 | options[b'revlogv0'] = True |
|
848 | options[b'revlogv0'] = True | |
870 |
|
849 | |||
871 | if COPIESSDC_REQUIREMENT in requirements: |
|
850 | if requirementsmod.COPIESSDC_REQUIREMENT in requirements: | |
872 | options[b'copies-storage'] = b'changeset-sidedata' |
|
851 | options[b'copies-storage'] = b'changeset-sidedata' | |
873 | else: |
|
852 | else: | |
874 | writecopiesto = ui.config(b'experimental', b'copies.write-to') |
|
853 | writecopiesto = ui.config(b'experimental', b'copies.write-to') | |
@@ -887,7 +866,7 b' def resolverevlogstorevfsoptions(ui, req' | |||||
887 |
|
866 | |||
888 | if b'revlogv1' in requirements: |
|
867 | if b'revlogv1' in requirements: | |
889 | options[b'revlogv1'] = True |
|
868 | options[b'revlogv1'] = True | |
890 | if REVLOGV2_REQUIREMENT in requirements: |
|
869 | if requirementsmod.REVLOGV2_REQUIREMENT in requirements: | |
891 | options[b'revlogv2'] = True |
|
870 | options[b'revlogv2'] = True | |
892 |
|
871 | |||
893 | if b'generaldelta' in requirements: |
|
872 | if b'generaldelta' in requirements: | |
@@ -931,12 +910,12 b' def resolverevlogstorevfsoptions(ui, req' | |||||
931 | options[b'sparse-read-density-threshold'] = srdensitythres |
|
910 | options[b'sparse-read-density-threshold'] = srdensitythres | |
932 | options[b'sparse-read-min-gap-size'] = srmingapsize |
|
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 | options[b'sparse-revlog'] = sparserevlog |
|
914 | options[b'sparse-revlog'] = sparserevlog | |
936 | if sparserevlog: |
|
915 | if sparserevlog: | |
937 | options[b'generaldelta'] = True |
|
916 | options[b'generaldelta'] = True | |
938 |
|
917 | |||
939 | sidedata = SIDEDATA_REQUIREMENT in requirements |
|
918 | sidedata = requirementsmod.SIDEDATA_REQUIREMENT in requirements | |
940 | options[b'side-data'] = sidedata |
|
919 | options[b'side-data'] = sidedata | |
941 |
|
920 | |||
942 | maxchainlen = None |
|
921 | maxchainlen = None | |
@@ -972,7 +951,7 b' def resolverevlogstorevfsoptions(ui, req' | |||||
972 |
|
951 | |||
973 | if ui.configbool(b'experimental', b'rust.index'): |
|
952 | if ui.configbool(b'experimental', b'rust.index'): | |
974 | options[b'rust.index'] = True |
|
953 | options[b'rust.index'] = True | |
975 | if NODEMAP_REQUIREMENT in requirements: |
|
954 | if requirementsmod.NODEMAP_REQUIREMENT in requirements: | |
976 | options[b'persistent-nodemap'] = True |
|
955 | options[b'persistent-nodemap'] = True | |
977 | if ui.configbool(b'storage', b'revlog.nodemap.mmap'): |
|
956 | if ui.configbool(b'storage', b'revlog.nodemap.mmap'): | |
978 | options[b'persistent-nodemap.mmap'] = True |
|
957 | options[b'persistent-nodemap.mmap'] = True | |
@@ -1058,11 +1037,11 b' class localrepository(object):' | |||||
1058 | b'revlogv1', |
|
1037 | b'revlogv1', | |
1059 | b'generaldelta', |
|
1038 | b'generaldelta', | |
1060 | requirementsmod.TREEMANIFEST_REQUIREMENT, |
|
1039 | requirementsmod.TREEMANIFEST_REQUIREMENT, | |
1061 | COPIESSDC_REQUIREMENT, |
|
1040 | requirementsmod.COPIESSDC_REQUIREMENT, | |
1062 | REVLOGV2_REQUIREMENT, |
|
1041 | requirementsmod.REVLOGV2_REQUIREMENT, | |
1063 | SIDEDATA_REQUIREMENT, |
|
1042 | requirementsmod.SIDEDATA_REQUIREMENT, | |
1064 | SPARSEREVLOG_REQUIREMENT, |
|
1043 | requirementsmod.SPARSEREVLOG_REQUIREMENT, | |
1065 | NODEMAP_REQUIREMENT, |
|
1044 | requirementsmod.NODEMAP_REQUIREMENT, | |
1066 | bookmarks.BOOKMARKS_IN_STORE_REQUIREMENT, |
|
1045 | bookmarks.BOOKMARKS_IN_STORE_REQUIREMENT, | |
1067 | } |
|
1046 | } | |
1068 | _basesupported = supportedformats | { |
|
1047 | _basesupported = supportedformats | { | |
@@ -1241,7 +1220,7 b' class localrepository(object):' | |||||
1241 | self._extrafilterid = repoview.extrafilter(ui) |
|
1220 | self._extrafilterid = repoview.extrafilter(ui) | |
1242 |
|
1221 | |||
1243 | self.filecopiesmode = None |
|
1222 | self.filecopiesmode = None | |
1244 | if COPIESSDC_REQUIREMENT in self.requirements: |
|
1223 | if requirementsmod.COPIESSDC_REQUIREMENT in self.requirements: | |
1245 | self.filecopiesmode = b'changeset-sidedata' |
|
1224 | self.filecopiesmode = b'changeset-sidedata' | |
1246 |
|
1225 | |||
1247 | def _getvfsward(self, origfunc): |
|
1226 | def _getvfsward(self, origfunc): | |
@@ -3308,15 +3287,15 b' def newreporequirements(ui, createopts):' | |||||
3308 | if scmutil.gdinitconfig(ui): |
|
3287 | if scmutil.gdinitconfig(ui): | |
3309 | requirements.add(b'generaldelta') |
|
3288 | requirements.add(b'generaldelta') | |
3310 | if ui.configbool(b'format', b'sparse-revlog'): |
|
3289 | if ui.configbool(b'format', b'sparse-revlog'): | |
3311 | requirements.add(SPARSEREVLOG_REQUIREMENT) |
|
3290 | requirements.add(requirementsmod.SPARSEREVLOG_REQUIREMENT) | |
3312 |
|
3291 | |||
3313 | # experimental config: format.exp-use-side-data |
|
3292 | # experimental config: format.exp-use-side-data | |
3314 | if ui.configbool(b'format', b'exp-use-side-data'): |
|
3293 | if ui.configbool(b'format', b'exp-use-side-data'): | |
3315 | requirements.add(SIDEDATA_REQUIREMENT) |
|
3294 | requirements.add(requirementsmod.SIDEDATA_REQUIREMENT) | |
3316 | # experimental config: format.exp-use-copies-side-data-changeset |
|
3295 | # experimental config: format.exp-use-copies-side-data-changeset | |
3317 | if ui.configbool(b'format', b'exp-use-copies-side-data-changeset'): |
|
3296 | if ui.configbool(b'format', b'exp-use-copies-side-data-changeset'): | |
3318 | requirements.add(SIDEDATA_REQUIREMENT) |
|
3297 | requirements.add(requirementsmod.SIDEDATA_REQUIREMENT) | |
3319 | requirements.add(COPIESSDC_REQUIREMENT) |
|
3298 | requirements.add(requirementsmod.COPIESSDC_REQUIREMENT) | |
3320 | if ui.configbool(b'experimental', b'treemanifest'): |
|
3299 | if ui.configbool(b'experimental', b'treemanifest'): | |
3321 | requirements.add(requirementsmod.TREEMANIFEST_REQUIREMENT) |
|
3300 | requirements.add(requirementsmod.TREEMANIFEST_REQUIREMENT) | |
3322 |
|
3301 | |||
@@ -3325,7 +3304,7 b' def newreporequirements(ui, createopts):' | |||||
3325 | requirements.remove(b'revlogv1') |
|
3304 | requirements.remove(b'revlogv1') | |
3326 | # generaldelta is implied by revlogv2. |
|
3305 | # generaldelta is implied by revlogv2. | |
3327 | requirements.discard(b'generaldelta') |
|
3306 | requirements.discard(b'generaldelta') | |
3328 | requirements.add(REVLOGV2_REQUIREMENT) |
|
3307 | requirements.add(requirementsmod.REVLOGV2_REQUIREMENT) | |
3329 | # experimental config: format.internal-phase |
|
3308 | # experimental config: format.internal-phase | |
3330 | if ui.configbool(b'format', b'internal-phase'): |
|
3309 | if ui.configbool(b'format', b'internal-phase'): | |
3331 | requirements.add(requirementsmod.INTERNAL_PHASE_REQUIREMENT) |
|
3310 | requirements.add(requirementsmod.INTERNAL_PHASE_REQUIREMENT) | |
@@ -3340,7 +3319,7 b' def newreporequirements(ui, createopts):' | |||||
3340 | requirements.add(bookmarks.BOOKMARKS_IN_STORE_REQUIREMENT) |
|
3319 | requirements.add(bookmarks.BOOKMARKS_IN_STORE_REQUIREMENT) | |
3341 |
|
3320 | |||
3342 | if ui.configbool(b'format', b'use-persistent-nodemap'): |
|
3321 | if ui.configbool(b'format', b'use-persistent-nodemap'): | |
3343 | requirements.add(NODEMAP_REQUIREMENT) |
|
3322 | requirements.add(requirementsmod.NODEMAP_REQUIREMENT) | |
3344 |
|
3323 | |||
3345 | return requirements |
|
3324 | return requirements | |
3346 |
|
3325 |
@@ -20,3 +20,27 b" INTERNAL_PHASE_REQUIREMENT = b'internal-" | |||||
20 |
|
20 | |||
21 | # Stores manifest in Tree structure |
|
21 | # Stores manifest in Tree structure | |
22 | TREEMANIFEST_REQUIREMENT = b'treemanifest' |
|
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 | # list of requirements that request a clone of all revlog if added/removed |
|
32 | # list of requirements that request a clone of all revlog if added/removed | |
33 | RECLONES_REQUIREMENTS = { |
|
33 | RECLONES_REQUIREMENTS = { | |
34 | b'generaldelta', |
|
34 | b'generaldelta', | |
35 |
|
|
35 | requirements.SPARSEREVLOG_REQUIREMENT, | |
36 | } |
|
36 | } | |
37 |
|
37 | |||
38 |
|
38 | |||
@@ -76,10 +76,10 b' def supportremovedrequirements(repo):' | |||||
76 | to be allowed. |
|
76 | to be allowed. | |
77 | """ |
|
77 | """ | |
78 | supported = { |
|
78 | supported = { | |
79 |
|
|
79 | requirements.SPARSEREVLOG_REQUIREMENT, | |
80 |
|
|
80 | requirements.SIDEDATA_REQUIREMENT, | |
81 |
|
|
81 | requirements.COPIESSDC_REQUIREMENT, | |
82 |
|
|
82 | requirements.NODEMAP_REQUIREMENT, | |
83 | } |
|
83 | } | |
84 | for name in compression.compengines: |
|
84 | for name in compression.compengines: | |
85 | engine = compression.compengines[name] |
|
85 | engine = compression.compengines[name] | |
@@ -104,10 +104,10 b' def supporteddestrequirements(repo):' | |||||
104 | b'generaldelta', |
|
104 | b'generaldelta', | |
105 | b'revlogv1', |
|
105 | b'revlogv1', | |
106 | b'store', |
|
106 | b'store', | |
107 |
|
|
107 | requirements.SPARSEREVLOG_REQUIREMENT, | |
108 |
|
|
108 | requirements.SIDEDATA_REQUIREMENT, | |
109 |
|
|
109 | requirements.COPIESSDC_REQUIREMENT, | |
110 |
|
|
110 | requirements.NODEMAP_REQUIREMENT, | |
111 | } |
|
111 | } | |
112 | for name in compression.compengines: |
|
112 | for name in compression.compengines: | |
113 | engine = compression.compengines[name] |
|
113 | engine = compression.compengines[name] | |
@@ -132,10 +132,10 b' def allowednewrequirements(repo):' | |||||
132 | b'dotencode', |
|
132 | b'dotencode', | |
133 | b'fncache', |
|
133 | b'fncache', | |
134 | b'generaldelta', |
|
134 | b'generaldelta', | |
135 |
|
|
135 | requirements.SPARSEREVLOG_REQUIREMENT, | |
136 |
|
|
136 | requirements.SIDEDATA_REQUIREMENT, | |
137 |
|
|
137 | requirements.COPIESSDC_REQUIREMENT, | |
138 |
|
|
138 | requirements.NODEMAP_REQUIREMENT, | |
139 | } |
|
139 | } | |
140 | for name in compression.compengines: |
|
140 | for name in compression.compengines: | |
141 | engine = compression.compengines[name] |
|
141 | engine = compression.compengines[name] | |
@@ -339,7 +339,7 b' class generaldelta(requirementformatvari' | |||||
339 | class sparserevlog(requirementformatvariant): |
|
339 | class sparserevlog(requirementformatvariant): | |
340 | name = b'sparserevlog' |
|
340 | name = b'sparserevlog' | |
341 |
|
341 | |||
342 |
_requirement = |
|
342 | _requirement = requirements.SPARSEREVLOG_REQUIREMENT | |
343 |
|
343 | |||
344 | default = True |
|
344 | default = True | |
345 |
|
345 | |||
@@ -365,7 +365,7 b' class sparserevlog(requirementformatvari' | |||||
365 | class sidedata(requirementformatvariant): |
|
365 | class sidedata(requirementformatvariant): | |
366 | name = b'sidedata' |
|
366 | name = b'sidedata' | |
367 |
|
367 | |||
368 |
_requirement = |
|
368 | _requirement = requirements.SIDEDATA_REQUIREMENT | |
369 |
|
369 | |||
370 | default = False |
|
370 | default = False | |
371 |
|
371 | |||
@@ -381,7 +381,7 b' class sidedata(requirementformatvariant)' | |||||
381 | class persistentnodemap(requirementformatvariant): |
|
381 | class persistentnodemap(requirementformatvariant): | |
382 | name = b'persistent-nodemap' |
|
382 | name = b'persistent-nodemap' | |
383 |
|
383 | |||
384 |
_requirement = |
|
384 | _requirement = requirements.NODEMAP_REQUIREMENT | |
385 |
|
385 | |||
386 | default = False |
|
386 | default = False | |
387 |
|
387 | |||
@@ -396,7 +396,7 b' class persistentnodemap(requirementforma' | |||||
396 | class copiessdc(requirementformatvariant): |
|
396 | class copiessdc(requirementformatvariant): | |
397 | name = b'copies-sdc' |
|
397 | name = b'copies-sdc' | |
398 |
|
398 | |||
399 |
_requirement = |
|
399 | _requirement = requirements.COPIESSDC_REQUIREMENT | |
400 |
|
400 | |||
401 | default = False |
|
401 | default = False | |
402 |
|
402 | |||
@@ -726,7 +726,7 b' def getsidedatacompanion(srcrepo, dstrep' | |||||
726 | sidedatacompanion = None |
|
726 | sidedatacompanion = None | |
727 | removedreqs = srcrepo.requirements - dstrepo.requirements |
|
727 | removedreqs = srcrepo.requirements - dstrepo.requirements | |
728 | addedreqs = dstrepo.requirements - srcrepo.requirements |
|
728 | addedreqs = dstrepo.requirements - srcrepo.requirements | |
729 |
if |
|
729 | if requirements.SIDEDATA_REQUIREMENT in removedreqs: | |
730 |
|
730 | |||
731 | def sidedatacompanion(rl, rev): |
|
731 | def sidedatacompanion(rl, rev): | |
732 | rl = getattr(rl, '_revlog', rl) |
|
732 | rl = getattr(rl, '_revlog', rl) | |
@@ -734,9 +734,9 b' def getsidedatacompanion(srcrepo, dstrep' | |||||
734 | return True, (), {} |
|
734 | return True, (), {} | |
735 | return False, (), {} |
|
735 | return False, (), {} | |
736 |
|
736 | |||
737 |
elif |
|
737 | elif requirements.COPIESSDC_REQUIREMENT in addedreqs: | |
738 | sidedatacompanion = metadata.getsidedataadder(srcrepo, dstrepo) |
|
738 | sidedatacompanion = metadata.getsidedataadder(srcrepo, dstrepo) | |
739 |
elif |
|
739 | elif requirements.COPIESSDC_REQUIREMENT in removedreqs: | |
740 | sidedatacompanion = metadata.getsidedataremover(srcrepo, dstrepo) |
|
740 | sidedatacompanion = metadata.getsidedataremover(srcrepo, dstrepo) | |
741 | return sidedatacompanion |
|
741 | return sidedatacompanion | |
742 |
|
742 |
@@ -12,8 +12,8 b' import struct' | |||||
12 |
|
12 | |||
13 | from mercurial import ( |
|
13 | from mercurial import ( | |
14 | extensions, |
|
14 | extensions, | |
15 | localrepo, |
|
|||
16 | node, |
|
15 | node, | |
|
16 | requirements, | |||
17 | revlog, |
|
17 | revlog, | |
18 | upgrade, |
|
18 | upgrade, | |
19 | ) |
|
19 | ) | |
@@ -54,7 +54,7 b' def wraprevision(orig, self, nodeorrev, ' | |||||
54 | def wrapgetsidedatacompanion(orig, srcrepo, dstrepo): |
|
54 | def wrapgetsidedatacompanion(orig, srcrepo, dstrepo): | |
55 | sidedatacompanion = orig(srcrepo, dstrepo) |
|
55 | sidedatacompanion = orig(srcrepo, dstrepo) | |
56 | addedreqs = dstrepo.requirements - srcrepo.requirements |
|
56 | addedreqs = dstrepo.requirements - srcrepo.requirements | |
57 |
if |
|
57 | if requirements.SIDEDATA_REQUIREMENT in addedreqs: | |
58 | assert sidedatacompanion is None # deal with composition later |
|
58 | assert sidedatacompanion is None # deal with composition later | |
59 |
|
59 | |||
60 | def sidedatacompanion(revlog, rev): |
|
60 | def sidedatacompanion(revlog, rev): |
General Comments 0
You need to be logged in to leave comments.
Login now