diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -479,8 +479,8 @@ def makelocalrepository(baseui, path, in # The store has changed over time and the exact layout is dictated by # requirements. The store interface abstracts differences across all # of them. - store = storemod.store(requirements, storebasepath, - lambda base: vfsmod.vfs(base, cacheaudited=True)) + store = makestore(requirements, storebasepath, + lambda base: vfsmod.vfs(base, cacheaudited=True)) hgvfs.createmode = store.createmode @@ -567,6 +567,17 @@ def ensurerequirementscompatible(ui, req b'sparse is not enabled; enable the ' b'"sparse" extensions to access')) +def makestore(requirements, path, vfstype): + """Construct a storage object for a repository.""" + if b'store' in requirements: + if b'fncache' in requirements: + return storemod.fncachestore(path, vfstype, + b'dotencode' in requirements) + + return storemod.encodedstore(path, vfstype) + + return storemod.basicstore(path, vfstype) + @interfaceutil.implementer(repository.completelocalrepository) class localrepository(object): diff --git a/mercurial/statichttprepo.py b/mercurial/statichttprepo.py --- a/mercurial/statichttprepo.py +++ b/mercurial/statichttprepo.py @@ -19,7 +19,6 @@ from . import ( manifest, namespaces, pathutil, - store, url, util, vfs as vfsmod, @@ -179,7 +178,7 @@ class statichttprepository(localrepo.loc localrepo.ensurerequirementscompatible(ui, requirements) # setup store - self.store = store.store(requirements, self.path, vfsclass) + self.store = localrepo.makestore(requirements, self.path, vfsclass) self.spath = self.store.path self.svfs = self.store.opener self.sjoin = self.store.join diff --git a/mercurial/store.py b/mercurial/store.py --- a/mercurial/store.py +++ b/mercurial/store.py @@ -585,10 +585,3 @@ class fncachestore(basicstore): if e.startswith(path) and self._exists(e): return True return False - -def store(requirements, path, vfstype): - if 'store' in requirements: - if 'fncache' in requirements: - return fncachestore(path, vfstype, 'dotencode' in requirements) - return encodedstore(path, vfstype) - return basicstore(path, vfstype) diff --git a/tests/test-fncache.t b/tests/test-fncache.t --- a/tests/test-fncache.t +++ b/tests/test-fncache.t @@ -448,7 +448,7 @@ changesets that only contain changes to $ cat > fncacheloadwarn.py << EOF > from __future__ import absolute_import - > from mercurial import extensions, store + > from mercurial import extensions, localrepo > > def extsetup(ui): > def wrapstore(orig, requirements, *args): @@ -456,7 +456,7 @@ changesets that only contain changes to > if 'store' in requirements and 'fncache' in requirements: > instrumentfncachestore(store, ui) > return store - > extensions.wrapfunction(store, 'store', wrapstore) + > extensions.wrapfunction(localrepo, 'makestore', wrapstore) > > def instrumentfncachestore(fncachestore, ui): > class instrumentedfncache(type(fncachestore.fncache)):