##// END OF EJS Templates
sidedata: introduce a new requirement to protect the feature...
marmoute -
r43298:827cb4fe default
parent child Browse files
Show More
@@ -733,6 +733,10 b" coreconfigitem('format', 'usegeneraldelt"
733 coreconfigitem('format', 'usestore',
733 coreconfigitem('format', 'usestore',
734 default=True,
734 default=True,
735 )
735 )
736 coreconfigitem('format', 'use-side-data',
737 default=False,
738 experimental=True,
739 )
736 coreconfigitem('format', 'internal-phase',
740 coreconfigitem('format', 'internal-phase',
737 default=False,
741 default=False,
738 experimental=True,
742 experimental=True,
@@ -394,6 +394,10 b" REVLOGV2_REQUIREMENT = 'exp-revlogv2.1'"
394 # This is why once a repository has enabled sparse-read, it becomes required.
394 # This is why once a repository has enabled sparse-read, it becomes required.
395 SPARSEREVLOG_REQUIREMENT = 'sparserevlog'
395 SPARSEREVLOG_REQUIREMENT = 'sparserevlog'
396
396
397 # A repository with the sidedataflag requirement will allow to store extra
398 # information for revision without altering their original hashes.
399 SIDEDATA_REQUIREMENT = 'exp-sidedata-flag'
400
397 # Functions receiving (ui, features) that extensions can register to impact
401 # Functions receiving (ui, features) that extensions can register to impact
398 # the ability to load repositories with custom requirements. Only
402 # the ability to load repositories with custom requirements. Only
399 # functions defined in loaded extensions are called.
403 # functions defined in loaded extensions are called.
@@ -814,6 +818,9 b' def resolverevlogstorevfsoptions(ui, req'
814 if sparserevlog:
818 if sparserevlog:
815 options[b'generaldelta'] = True
819 options[b'generaldelta'] = True
816
820
821 sidedata = SIDEDATA_REQUIREMENT in requirements
822 options[b'side-data'] = sidedata
823
817 maxchainlen = None
824 maxchainlen = None
818 if sparserevlog:
825 if sparserevlog:
819 maxchainlen = revlogconst.SPARSE_REVLOG_MAX_CHAIN_LENGTH
826 maxchainlen = revlogconst.SPARSE_REVLOG_MAX_CHAIN_LENGTH
@@ -917,6 +924,7 b' class localrepository(object):'
917 'generaldelta',
924 'generaldelta',
918 'treemanifest',
925 'treemanifest',
919 REVLOGV2_REQUIREMENT,
926 REVLOGV2_REQUIREMENT,
927 SIDEDATA_REQUIREMENT,
920 SPARSEREVLOG_REQUIREMENT,
928 SPARSEREVLOG_REQUIREMENT,
921 bookmarks.BOOKMARKS_IN_STORE_REQUIREMENT,
929 bookmarks.BOOKMARKS_IN_STORE_REQUIREMENT,
922 }
930 }
@@ -3153,6 +3161,10 b' def newreporequirements(ui, createopts):'
3153 requirements.add('generaldelta')
3161 requirements.add('generaldelta')
3154 if ui.configbool('format', 'sparse-revlog'):
3162 if ui.configbool('format', 'sparse-revlog'):
3155 requirements.add(SPARSEREVLOG_REQUIREMENT)
3163 requirements.add(SPARSEREVLOG_REQUIREMENT)
3164
3165 # experimental config: format.use-side-data
3166 if ui.configbool('format', 'use-side-data'):
3167 requirements.add(SIDEDATA_REQUIREMENT)
3156 if ui.configbool('experimental', 'treemanifest'):
3168 if ui.configbool('experimental', 'treemanifest'):
3157 requirements.add('treemanifest')
3169 requirements.add('treemanifest')
3158
3170
@@ -388,6 +388,7 b' class revlog(object):'
388 self._maxdeltachainspan = opts['maxdeltachainspan']
388 self._maxdeltachainspan = opts['maxdeltachainspan']
389 if self._mmaplargeindex and 'mmapindexthreshold' in opts:
389 if self._mmaplargeindex and 'mmapindexthreshold' in opts:
390 mmapindexthreshold = opts['mmapindexthreshold']
390 mmapindexthreshold = opts['mmapindexthreshold']
391 self.hassidedata = bool(opts.get('side-data', False))
391 self._sparserevlog = bool(opts.get('sparse-revlog', False))
392 self._sparserevlog = bool(opts.get('sparse-revlog', False))
392 withsparseread = bool(opts.get('with-sparse-read', False))
393 withsparseread = bool(opts.get('with-sparse-read', False))
393 # sparse-revlog forces sparse-read
394 # sparse-revlog forces sparse-read
@@ -1849,6 +1850,10 b' class revlog(object):'
1849
1850
1850 if sidedata is None:
1851 if sidedata is None:
1851 sidedata = {}
1852 sidedata = {}
1853 elif not self.hassidedata:
1854 raise error.ProgrammingError(
1855 _("trying to add sidedata to a revlog who don't support them")
1856 )
1852
1857
1853 if flags:
1858 if flags:
1854 node = node or self.hash(text, p1, p2)
1859 node = node or self.hash(text, p1, p2)
General Comments 0
You need to be logged in to leave comments. Login now