mercurial/localrepo.py
changeset 39698 f44187605315
parent 39697 98ca9078807a
child 39699 6f26417b71bb
equal deleted inserted replaced
39697:98ca9078807a 39698:f44187605315
   477         cachepath = hgvfs.join(b'cache')
   477         cachepath = hgvfs.join(b'cache')
   478 
   478 
   479     # The store has changed over time and the exact layout is dictated by
   479     # The store has changed over time and the exact layout is dictated by
   480     # requirements. The store interface abstracts differences across all
   480     # requirements. The store interface abstracts differences across all
   481     # of them.
   481     # of them.
   482     store = storemod.store(requirements, storebasepath,
   482     store = makestore(requirements, storebasepath,
   483                            lambda base: vfsmod.vfs(base, cacheaudited=True))
   483                       lambda base: vfsmod.vfs(base, cacheaudited=True))
   484 
   484 
   485     hgvfs.createmode = store.createmode
   485     hgvfs.createmode = store.createmode
   486 
   486 
   487     # The cache vfs is used to manage cache files.
   487     # The cache vfs is used to manage cache files.
   488     cachevfs = vfsmod.vfs(cachepath, cacheaudited=True)
   488     cachevfs = vfsmod.vfs(cachepath, cacheaudited=True)
   564     """
   564     """
   565     if b'exp-sparse' in requirements and not sparse.enabled:
   565     if b'exp-sparse' in requirements and not sparse.enabled:
   566         raise error.RepoError(_(b'repository is using sparse feature but '
   566         raise error.RepoError(_(b'repository is using sparse feature but '
   567                                 b'sparse is not enabled; enable the '
   567                                 b'sparse is not enabled; enable the '
   568                                 b'"sparse" extensions to access'))
   568                                 b'"sparse" extensions to access'))
       
   569 
       
   570 def makestore(requirements, path, vfstype):
       
   571     """Construct a storage object for a repository."""
       
   572     if b'store' in requirements:
       
   573         if b'fncache' in requirements:
       
   574             return storemod.fncachestore(path, vfstype,
       
   575                                          b'dotencode' in requirements)
       
   576 
       
   577         return storemod.encodedstore(path, vfstype)
       
   578 
       
   579     return storemod.basicstore(path, vfstype)
   569 
   580 
   570 @interfaceutil.implementer(repository.completelocalrepository)
   581 @interfaceutil.implementer(repository.completelocalrepository)
   571 class localrepository(object):
   582 class localrepository(object):
   572 
   583 
   573     # obsolete experimental requirements:
   584     # obsolete experimental requirements: