D4574: localrepo: move store() from store module
indygreg (Gregory Szorc)
phabricator at mercurial-scm.org
Tue Sep 18 22:01:04 UTC 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGf44187605315: localrepo: move store() from store module (authored by indygreg, committed by ).
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D4574?vs=11012&id=11171
REVISION DETAIL
https://phab.mercurial-scm.org/D4574
AFFECTED FILES
mercurial/localrepo.py
mercurial/statichttprepo.py
mercurial/store.py
tests/test-fncache.t
CHANGE DETAILS
diff --git a/tests/test-fncache.t b/tests/test-fncache.t
--- a/tests/test-fncache.t
+++ b/tests/test-fncache.t
@@ -448,15 +448,15 @@
$ 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):
> store = orig(requirements, *args)
> 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)):
diff --git a/mercurial/store.py b/mercurial/store.py
--- a/mercurial/store.py
+++ b/mercurial/store.py
@@ -585,10 +585,3 @@
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/mercurial/statichttprepo.py b/mercurial/statichttprepo.py
--- a/mercurial/statichttprepo.py
+++ b/mercurial/statichttprepo.py
@@ -19,7 +19,6 @@
manifest,
namespaces,
pathutil,
- store,
url,
util,
vfs as vfsmod,
@@ -179,7 +178,7 @@
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/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -479,8 +479,8 @@
# 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 @@
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):
To: indygreg, #hg-reviewers
Cc: mjpieters, mercurial-devel
More information about the Mercurial-devel
mailing list