changeset 6896:40690d614ce6

store: take opener as an argument
author Matt Mackall <mpm@selenic.com>
date Wed, 13 Aug 2008 20:18:42 -0500
parents a6bb94930105
children faea0d27e38f
files mercurial/localrepo.py mercurial/store.py
diffstat 2 files changed, 8 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/localrepo.py	Wed Aug 13 20:18:42 2008 -0500
+++ b/mercurial/localrepo.py	Wed Aug 13 20:18:42 2008 -0500
@@ -60,7 +60,7 @@
                 if inst.errno != errno.ENOENT:
                     raise
 
-        self.store = store.store(requirements, self.path)
+        self.store = store.store(requirements, self.path, util.opener)
         self.spath = self.store.path
         self.sopener = self.store.opener
         self.sjoin = self.store.join
--- a/mercurial/store.py	Wed Aug 13 20:18:42 2008 -0500
+++ b/mercurial/store.py	Wed Aug 13 20:18:42 2008 -0500
@@ -94,16 +94,16 @@
             yield x
 
 class directstore(_store):
-    def __init__(self, path):
+    def __init__(self, path, opener):
         _store.__init__(self, path)
-        self.opener = util.opener(self.path)
+        self.opener = opener(self.path)
         self.opener.createmode = self.createmode
 
 class encodedstore(_store):
-    def __init__(self, path):
+    def __init__(self, path, opener):
         _store.__init__(self, os.path.join(path, 'store'))
         self.encodefn = encodefilename
-        op = util.opener(self.path)
+        op = opener(self.path)
         op.createmode = self.createmode
         self.opener = lambda f, *args, **kw: op(self.encodefn(f), *args, **kw)
 
@@ -125,8 +125,8 @@
     else:
         return encodefilename
 
-def store(requirements, path):
+def store(requirements, path, opener):
     if 'store' not in requirements:
-        return directstore(path)
+        return directstore(path, opener)
     else:
-        return encodedstore(path)
+        return encodedstore(path, opener)