Show More
@@ -231,6 +231,16 b' class opener(abstractopener):' | |||
|
231 | 231 | f.close() |
|
232 | 232 | self._fixfilemode(dst) |
|
233 | 233 | |
|
234 | class filteropener(abstractopener): | |
|
235 | '''Wrapper opener for filtering filenames with a function.''' | |
|
236 | ||
|
237 | def __init__(self, opener, filter): | |
|
238 | self._filter = filter | |
|
239 | self._orig = opener | |
|
240 | ||
|
241 | def __call__(self, path, *args, **kwargs): | |
|
242 | return self._orig(self._filter(path), *args, **kwargs) | |
|
243 | ||
|
234 | 244 | def canonpath(root, cwd, myname, auditor=None): |
|
235 | 245 | '''return the canonical path of myname, given cwd and root''' |
|
236 | 246 | if util.endswithsep(root): |
@@ -6,7 +6,7 b'' | |||
|
6 | 6 | # GNU General Public License version 2 or any later version. |
|
7 | 7 | |
|
8 | 8 | from i18n import _ |
|
9 | import osutil, util | |
|
9 | import osutil, scmutil, util | |
|
10 | 10 | import os, stat |
|
11 | 11 | |
|
12 | 12 | _sha = util.sha1 |
@@ -241,7 +241,7 b' class basicstore(object):' | |||
|
241 | 241 | self.createmode = _calcmode(path) |
|
242 | 242 | op = opener(self.path) |
|
243 | 243 | op.createmode = self.createmode |
|
244 | self.opener = lambda f, *args, **kw: op(encodedir(f), *args, **kw) | |
|
244 | self.opener = scmutil.filteropener(op, encodedir) | |
|
245 | 245 | |
|
246 | 246 | def join(self, f): |
|
247 | 247 | return self.path + '/' + encodedir(f) |
@@ -290,7 +290,7 b' class encodedstore(basicstore):' | |||
|
290 | 290 | self.createmode = _calcmode(self.path) |
|
291 | 291 | op = opener(self.path) |
|
292 | 292 | op.createmode = self.createmode |
|
293 | self.opener = lambda f, *args, **kw: op(encodefilename(f), *args, **kw) | |
|
293 | self.opener = scmutil.filteropener(op, encodefilename) | |
|
294 | 294 | |
|
295 | 295 | def datafiles(self): |
|
296 | 296 | for a, b, size in self._walk('data', True): |
General Comments 0
You need to be logged in to leave comments.
Login now