comparison mercurial/localrepo.py @ 46676:ab58098bebed

requirements: also add a store constant Continue the cleanup to the remaining requirements Differential Revision: https://phab.mercurial-scm.org/D10108
author Rapha?l Gom?s <rgomes@octobus.net>
date Wed, 03 Mar 2021 12:35:29 +0100
parents c3773636ddbb
children b4c2a2af25e2
comparison
equal deleted inserted replaced
46675:c3773636ddbb 46676:ab58098bebed
940 ) 940 )
941 941
942 942
943 def makestore(requirements, path, vfstype): 943 def makestore(requirements, path, vfstype):
944 """Construct a storage object for a repository.""" 944 """Construct a storage object for a repository."""
945 if b'store' in requirements: 945 if requirementsmod.STORE_REQUIREMENT in requirements:
946 if b'fncache' in requirements: 946 if b'fncache' in requirements:
947 dotencode = requirementsmod.DOTENCODE_REQUIREMENT in requirements 947 dotencode = requirementsmod.DOTENCODE_REQUIREMENT in requirements
948 return storemod.fncachestore(path, vfstype, dotencode) 948 return storemod.fncachestore(path, vfstype, dotencode)
949 949
950 return storemod.encodedstore(path, vfstype) 950 return storemod.encodedstore(path, vfstype)
1208 requirementsmod.NODEMAP_REQUIREMENT, 1208 requirementsmod.NODEMAP_REQUIREMENT,
1209 bookmarks.BOOKMARKS_IN_STORE_REQUIREMENT, 1209 bookmarks.BOOKMARKS_IN_STORE_REQUIREMENT,
1210 requirementsmod.SHARESAFE_REQUIREMENT, 1210 requirementsmod.SHARESAFE_REQUIREMENT,
1211 } 1211 }
1212 _basesupported = supportedformats | { 1212 _basesupported = supportedformats | {
1213 b'store', 1213 requirementsmod.STORE_REQUIREMENT,
1214 b'fncache', 1214 b'fncache',
1215 requirementsmod.SHARED_REQUIREMENT, 1215 requirementsmod.SHARED_REQUIREMENT,
1216 requirementsmod.RELATIVE_SHARED_REQUIREMENT, 1216 requirementsmod.RELATIVE_SHARED_REQUIREMENT,
1217 requirementsmod.DOTENCODE_REQUIREMENT, 1217 requirementsmod.DOTENCODE_REQUIREMENT,
1218 requirementsmod.SPARSE_REQUIREMENT, 1218 requirementsmod.SPARSE_REQUIREMENT,
3409 % createopts[b'backend'] 3409 % createopts[b'backend']
3410 ) 3410 )
3411 3411
3412 requirements = {requirementsmod.REVLOGV1_REQUIREMENT} 3412 requirements = {requirementsmod.REVLOGV1_REQUIREMENT}
3413 if ui.configbool(b'format', b'usestore'): 3413 if ui.configbool(b'format', b'usestore'):
3414 requirements.add(b'store') 3414 requirements.add(requirementsmod.STORE_REQUIREMENT)
3415 if ui.configbool(b'format', b'usefncache'): 3415 if ui.configbool(b'format', b'usefncache'):
3416 requirements.add(b'fncache') 3416 requirements.add(b'fncache')
3417 if ui.configbool(b'format', b'dotencode'): 3417 if ui.configbool(b'format', b'dotencode'):
3418 requirements.add(requirementsmod.DOTENCODE_REQUIREMENT) 3418 requirements.add(requirementsmod.DOTENCODE_REQUIREMENT)
3419 3419
3491 Returns a set of requirements which needs to be dropped because dependend 3491 Returns a set of requirements which needs to be dropped because dependend
3492 requirements are not enabled. Also warns users about it""" 3492 requirements are not enabled. Also warns users about it"""
3493 3493
3494 dropped = set() 3494 dropped = set()
3495 3495
3496 if b'store' not in requirements: 3496 if requirementsmod.STORE_REQUIREMENT not in requirements:
3497 if bookmarks.BOOKMARKS_IN_STORE_REQUIREMENT in requirements: 3497 if bookmarks.BOOKMARKS_IN_STORE_REQUIREMENT in requirements:
3498 ui.warn( 3498 ui.warn(
3499 _( 3499 _(
3500 b'ignoring enabled \'format.bookmarks-in-store\' config ' 3500 b'ignoring enabled \'format.bookmarks-in-store\' config '
3501 b'beacuse it is incompatible with disabled ' 3501 b'beacuse it is incompatible with disabled '
3630 hgvfs.makedir(notindexed=True) 3630 hgvfs.makedir(notindexed=True)
3631 if b'sharedrepo' not in createopts: 3631 if b'sharedrepo' not in createopts:
3632 hgvfs.mkdir(b'cache') 3632 hgvfs.mkdir(b'cache')
3633 hgvfs.mkdir(b'wcache') 3633 hgvfs.mkdir(b'wcache')
3634 3634
3635 if b'store' in requirements and b'sharedrepo' not in createopts: 3635 has_store = requirementsmod.STORE_REQUIREMENT in requirements
3636 if has_store and b'sharedrepo' not in createopts:
3636 hgvfs.mkdir(b'store') 3637 hgvfs.mkdir(b'store')
3637 3638
3638 # We create an invalid changelog outside the store so very old 3639 # We create an invalid changelog outside the store so very old
3639 # Mercurial versions (which didn't know about the requirements 3640 # Mercurial versions (which didn't know about the requirements
3640 # file) encounter an error on reading the changelog. This 3641 # file) encounter an error on reading the changelog. This