diff mercurial/localrepo.py @ 39698:f44187605315

localrepo: move store() from store module I want logic related to requirements handling to be in the localrepo module so it is all in one place. I would have loved to inline this logic. Unfortunately, statichttprepo also calls it. I didn't want to inline it twice. We could potentially refactor statichttppeer. But meh. Differential Revision: https://phab.mercurial-scm.org/D4574
author Gregory Szorc <gregory.szorc@gmail.com>
date Wed, 12 Sep 2018 15:07:27 -0700
parents 98ca9078807a
children 6f26417b71bb
line wrap: on
line diff
--- a/mercurial/localrepo.py	Wed Sep 12 15:05:51 2018 -0700
+++ b/mercurial/localrepo.py	Wed Sep 12 15:07:27 2018 -0700
@@ -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):