Mercurial > hg
comparison mercurial/store.py @ 17728:004bd533880d
store: invoke "os.path.isdir()" via vfs
This patch invokes "os.path.isdir()" via "rawvfs" object to avoid
filename encoding, because the path passed to "os.path.isdir()"
shouldn't be encoded.
This patch newly adds "self.rawvfs" field only to "basicstore" and
"encodedstore", because "fncachestore" has "self.rawvfs" already.
author | FUJIWARA Katsunori <foozy@lares.dti.ne.jp> |
---|---|
date | Tue, 09 Oct 2012 01:41:55 +0900 |
parents | 6492b39a44d5 |
children | c85dbae29684 |
comparison
equal
deleted
inserted
replaced
17727:6492b39a44d5 | 17728:004bd533880d |
---|---|
293 def __init__(self, path, vfstype): | 293 def __init__(self, path, vfstype): |
294 vfs = vfstype(path) | 294 vfs = vfstype(path) |
295 self.path = vfs.base | 295 self.path = vfs.base |
296 self.createmode = _calcmode(vfs) | 296 self.createmode = _calcmode(vfs) |
297 vfs.createmode = self.createmode | 297 vfs.createmode = self.createmode |
298 self.rawvfs = vfs | |
298 self.vfs = scmutil.filtervfs(vfs, encodedir) | 299 self.vfs = scmutil.filtervfs(vfs, encodedir) |
299 self.opener = self.vfs | 300 self.opener = self.vfs |
300 | 301 |
301 def join(self, f): | 302 def join(self, f): |
302 return self.path + '/' + encodedir(f) | 303 return self.path + '/' + encodedir(f) |
306 path = self.path | 307 path = self.path |
307 if relpath: | 308 if relpath: |
308 path += '/' + relpath | 309 path += '/' + relpath |
309 striplen = len(self.path) + 1 | 310 striplen = len(self.path) + 1 |
310 l = [] | 311 l = [] |
311 if os.path.isdir(path): | 312 if self.rawvfs.isdir(path): |
312 visit = [path] | 313 visit = [path] |
313 while visit: | 314 while visit: |
314 p = visit.pop() | 315 p = visit.pop() |
315 for f, kind, st in osutil.listdir(p, stat=True): | 316 for f, kind, st in osutil.listdir(p, stat=True): |
316 fp = p + '/' + f | 317 fp = p + '/' + f |
344 def __init__(self, path, vfstype): | 345 def __init__(self, path, vfstype): |
345 vfs = vfstype(path + '/store') | 346 vfs = vfstype(path + '/store') |
346 self.path = vfs.base | 347 self.path = vfs.base |
347 self.createmode = _calcmode(vfs) | 348 self.createmode = _calcmode(vfs) |
348 vfs.createmode = self.createmode | 349 vfs.createmode = self.createmode |
350 self.rawvfs = vfs | |
349 self.vfs = scmutil.filtervfs(vfs, encodefilename) | 351 self.vfs = scmutil.filtervfs(vfs, encodefilename) |
350 self.opener = self.vfs | 352 self.opener = self.vfs |
351 | 353 |
352 def datafiles(self): | 354 def datafiles(self): |
353 for a, b, size in self._walk('data', True): | 355 for a, b, size in self._walk('data', True): |