##// 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 if inst.errno != errno.ENOENT:
60 if inst.errno != errno.ENOENT:
61 raise
61 raise
62
62
63 self.store = store.store(requirements, self.path)
63 self.store = store.store(requirements, self.path, util.opener)
64 self.spath = self.store.path
64 self.spath = self.store.path
65 self.sopener = self.store.opener
65 self.sopener = self.store.opener
66 self.sjoin = self.store.join
66 self.sjoin = self.store.join
@@ -94,16 +94,16 b' class _store:'
94 yield x
94 yield x
95
95
96 class directstore(_store):
96 class directstore(_store):
97 def __init__(self, path):
97 def __init__(self, path, opener):
98 _store.__init__(self, path)
98 _store.__init__(self, path)
99 self.opener = util.opener(self.path)
99 self.opener = opener(self.path)
100 self.opener.createmode = self.createmode
100 self.opener.createmode = self.createmode
101
101
102 class encodedstore(_store):
102 class encodedstore(_store):
103 def __init__(self, path):
103 def __init__(self, path, opener):
104 _store.__init__(self, os.path.join(path, 'store'))
104 _store.__init__(self, os.path.join(path, 'store'))
105 self.encodefn = encodefilename
105 self.encodefn = encodefilename
106 op = util.opener(self.path)
106 op = opener(self.path)
107 op.createmode = self.createmode
107 op.createmode = self.createmode
108 self.opener = lambda f, *args, **kw: op(self.encodefn(f), *args, **kw)
108 self.opener = lambda f, *args, **kw: op(self.encodefn(f), *args, **kw)
109
109
@@ -125,8 +125,8 b' def encodefn(requirements):'
125 else:
125 else:
126 return encodefilename
126 return encodefilename
127
127
128 def store(requirements, path):
128 def store(requirements, path, opener):
129 if 'store' not in requirements:
129 if 'store' not in requirements:
130 return directstore(path)
130 return directstore(path, opener)
131 else:
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