##// END OF EJS Templates
localrepo: move store() from store module...
Gregory Szorc -
r39734:f4418760 default
parent child Browse files
Show More
@@ -479,7 +479,7 b' def makelocalrepository(baseui, path, in'
479 479 # The store has changed over time and the exact layout is dictated by
480 480 # requirements. The store interface abstracts differences across all
481 481 # of them.
482 store = storemod.store(requirements, storebasepath,
482 store = makestore(requirements, storebasepath,
483 483 lambda base: vfsmod.vfs(base, cacheaudited=True))
484 484
485 485 hgvfs.createmode = store.createmode
@@ -567,6 +567,17 b' def ensurerequirementscompatible(ui, req'
567 567 b'sparse is not enabled; enable the '
568 568 b'"sparse" extensions to access'))
569 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)
580
570 581 @interfaceutil.implementer(repository.completelocalrepository)
571 582 class localrepository(object):
572 583
@@ -19,7 +19,6 b' from . import ('
19 19 manifest,
20 20 namespaces,
21 21 pathutil,
22 store,
23 22 url,
24 23 util,
25 24 vfs as vfsmod,
@@ -179,7 +178,7 b' class statichttprepository(localrepo.loc'
179 178 localrepo.ensurerequirementscompatible(ui, requirements)
180 179
181 180 # setup store
182 self.store = store.store(requirements, self.path, vfsclass)
181 self.store = localrepo.makestore(requirements, self.path, vfsclass)
183 182 self.spath = self.store.path
184 183 self.svfs = self.store.opener
185 184 self.sjoin = self.store.join
@@ -585,10 +585,3 b' class fncachestore(basicstore):'
585 585 if e.startswith(path) and self._exists(e):
586 586 return True
587 587 return False
588
589 def store(requirements, path, vfstype):
590 if 'store' in requirements:
591 if 'fncache' in requirements:
592 return fncachestore(path, vfstype, 'dotencode' in requirements)
593 return encodedstore(path, vfstype)
594 return basicstore(path, vfstype)
@@ -448,7 +448,7 b' changesets that only contain changes to '
448 448
449 449 $ cat > fncacheloadwarn.py << EOF
450 450 > from __future__ import absolute_import
451 > from mercurial import extensions, store
451 > from mercurial import extensions, localrepo
452 452 >
453 453 > def extsetup(ui):
454 454 > def wrapstore(orig, requirements, *args):
@@ -456,7 +456,7 b' changesets that only contain changes to '
456 456 > if 'store' in requirements and 'fncache' in requirements:
457 457 > instrumentfncachestore(store, ui)
458 458 > return store
459 > extensions.wrapfunction(store, 'store', wrapstore)
459 > extensions.wrapfunction(localrepo, 'makestore', wrapstore)
460 460 >
461 461 > def instrumentfncachestore(fncachestore, ui):
462 462 > class instrumentedfncache(type(fncachestore.fncache)):
General Comments 0
You need to be logged in to leave comments. Login now