Show More
@@ -479,8 +479,8 b' def makelocalrepository(baseui, path, in' | |||||
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 = |
|
482 | store = makestore(requirements, storebasepath, | |
483 |
|
|
483 | lambda base: vfsmod.vfs(base, cacheaudited=True)) | |
484 |
|
484 | |||
485 | hgvfs.createmode = store.createmode |
|
485 | hgvfs.createmode = store.createmode | |
486 |
|
486 | |||
@@ -567,6 +567,17 b' def ensurerequirementscompatible(ui, req' | |||||
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 |
|
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 | @interfaceutil.implementer(repository.completelocalrepository) |
|
581 | @interfaceutil.implementer(repository.completelocalrepository) | |
571 | class localrepository(object): |
|
582 | class localrepository(object): | |
572 |
|
583 |
@@ -19,7 +19,6 b' from . import (' | |||||
19 | manifest, |
|
19 | manifest, | |
20 | namespaces, |
|
20 | namespaces, | |
21 | pathutil, |
|
21 | pathutil, | |
22 | store, |
|
|||
23 | url, |
|
22 | url, | |
24 | util, |
|
23 | util, | |
25 | vfs as vfsmod, |
|
24 | vfs as vfsmod, | |
@@ -179,7 +178,7 b' class statichttprepository(localrepo.loc' | |||||
179 | localrepo.ensurerequirementscompatible(ui, requirements) |
|
178 | localrepo.ensurerequirementscompatible(ui, requirements) | |
180 |
|
179 | |||
181 | # setup store |
|
180 | # setup store | |
182 |
self.store = |
|
181 | self.store = localrepo.makestore(requirements, self.path, vfsclass) | |
183 | self.spath = self.store.path |
|
182 | self.spath = self.store.path | |
184 | self.svfs = self.store.opener |
|
183 | self.svfs = self.store.opener | |
185 | self.sjoin = self.store.join |
|
184 | self.sjoin = self.store.join |
@@ -585,10 +585,3 b' class fncachestore(basicstore):' | |||||
585 | if e.startswith(path) and self._exists(e): |
|
585 | if e.startswith(path) and self._exists(e): | |
586 | return True |
|
586 | return True | |
587 | return False |
|
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 | $ cat > fncacheloadwarn.py << EOF |
|
449 | $ cat > fncacheloadwarn.py << EOF | |
450 | > from __future__ import absolute_import |
|
450 | > from __future__ import absolute_import | |
451 |
> from mercurial import extensions, |
|
451 | > from mercurial import extensions, localrepo | |
452 | > |
|
452 | > | |
453 | > def extsetup(ui): |
|
453 | > def extsetup(ui): | |
454 | > def wrapstore(orig, requirements, *args): |
|
454 | > def wrapstore(orig, requirements, *args): | |
@@ -456,7 +456,7 b' changesets that only contain changes to ' | |||||
456 | > if 'store' in requirements and 'fncache' in requirements: |
|
456 | > if 'store' in requirements and 'fncache' in requirements: | |
457 | > instrumentfncachestore(store, ui) |
|
457 | > instrumentfncachestore(store, ui) | |
458 | > return store |
|
458 | > return store | |
459 |
> extensions.wrapfunction( |
|
459 | > extensions.wrapfunction(localrepo, 'makestore', wrapstore) | |
460 | > |
|
460 | > | |
461 | > def instrumentfncachestore(fncachestore, ui): |
|
461 | > def instrumentfncachestore(fncachestore, ui): | |
462 | > class instrumentedfncache(type(fncachestore.fncache)): |
|
462 | > class instrumentedfncache(type(fncachestore.fncache)): |
General Comments 0
You need to be logged in to leave comments.
Login now