##// END OF EJS Templates
store: take opener as an argument
Matt Mackall -
r6896:40690d61 default
parent child Browse files
Show More
@@ -60,7 +60,7 b' class localrepository(repo.repository):'
60 60 if inst.errno != errno.ENOENT:
61 61 raise
62 62
63 self.store = store.store(requirements, self.path)
63 self.store = store.store(requirements, self.path, util.opener)
64 64 self.spath = self.store.path
65 65 self.sopener = self.store.opener
66 66 self.sjoin = self.store.join
@@ -94,16 +94,16 b' class _store:'
94 94 yield x
95 95
96 96 class directstore(_store):
97 def __init__(self, path):
97 def __init__(self, path, opener):
98 98 _store.__init__(self, path)
99 self.opener = util.opener(self.path)
99 self.opener = opener(self.path)
100 100 self.opener.createmode = self.createmode
101 101
102 102 class encodedstore(_store):
103 def __init__(self, path):
103 def __init__(self, path, opener):
104 104 _store.__init__(self, os.path.join(path, 'store'))
105 105 self.encodefn = encodefilename
106 op = util.opener(self.path)
106 op = opener(self.path)
107 107 op.createmode = self.createmode
108 108 self.opener = lambda f, *args, **kw: op(self.encodefn(f), *args, **kw)
109 109
@@ -125,8 +125,8 b' def encodefn(requirements):'
125 125 else:
126 126 return encodefilename
127 127
128 def store(requirements, path):
128 def store(requirements, path, opener):
129 129 if 'store' not in requirements:
130 return directstore(path)
130 return directstore(path, opener)
131 131 else:
132 return encodedstore(path)
132 return encodedstore(path, opener)
General Comments 0
You need to be logged in to leave comments. Login now