92 meta.reverse() |
92 meta.reverse() |
93 for x in meta: |
93 for x in meta: |
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 |
110 def datafiles(self, reporterror=None): |
110 def datafiles(self, reporterror=None): |
111 for f, size in self._revlogfiles('data', True): |
111 for f, size in self._revlogfiles('data', True): |
123 if 'store' not in requirements: |
123 if 'store' not in requirements: |
124 return lambda x: x |
124 return lambda x: x |
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) |