Previously, the walking mechanism assumed the use of revlogs for
storage.
Making the file filter configurable will enable custom stores
to override _walk() so it recognizes additional files.
( )
hg-reviewers |
Previously, the walking mechanism assumed the use of revlogs for
storage.
Making the file filter configurable will enable custom stores
to override _walk() so it recognizes additional files.
Automatic diff as part of commit; lint not applicable. |
Automatic diff as part of commit; unit tests not applicable. |
Path | Packages | |||
---|---|---|---|---|
M | mercurial/store.py (7 lines) |
Status | Author | Revision | |
---|---|---|---|
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Abandoned | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg |
mode = None | mode = None | ||||
except OSError: | except OSError: | ||||
mode = None | mode = None | ||||
return mode | return mode | ||||
_data = ('data meta 00manifest.d 00manifest.i 00changelog.d 00changelog.i' | _data = ('data meta 00manifest.d 00manifest.i 00changelog.d 00changelog.i' | ||||
' phaseroots obsstore') | ' phaseroots obsstore') | ||||
def isrevlog(f, kind, st): | |||||
return kind == stat.S_IFREG and f[-2:] in ('.i', '.d') | |||||
class basicstore(object): | class basicstore(object): | ||||
'''base class for local repository stores''' | '''base class for local repository stores''' | ||||
def __init__(self, path, vfstype): | def __init__(self, path, vfstype): | ||||
vfs = vfstype(path) | vfs = vfstype(path) | ||||
self.path = vfs.base | self.path = vfs.base | ||||
self.createmode = _calcmode(vfs) | self.createmode = _calcmode(vfs) | ||||
vfs.createmode = self.createmode | vfs.createmode = self.createmode | ||||
self.rawvfs = vfs | self.rawvfs = vfs | ||||
self.vfs = vfsmod.filtervfs(vfs, encodedir) | self.vfs = vfsmod.filtervfs(vfs, encodedir) | ||||
self.opener = self.vfs | self.opener = self.vfs | ||||
def join(self, f): | def join(self, f): | ||||
return self.path + '/' + encodedir(f) | return self.path + '/' + encodedir(f) | ||||
def _walk(self, relpath, recurse): | def _walk(self, relpath, recurse, filefilter=isrevlog): | ||||
'''yields (unencoded, encoded, size)''' | '''yields (unencoded, encoded, size)''' | ||||
path = self.path | path = self.path | ||||
if relpath: | if relpath: | ||||
path += '/' + relpath | path += '/' + relpath | ||||
striplen = len(self.path) + 1 | striplen = len(self.path) + 1 | ||||
l = [] | l = [] | ||||
if self.rawvfs.isdir(path): | if self.rawvfs.isdir(path): | ||||
visit = [path] | visit = [path] | ||||
readdir = self.rawvfs.readdir | readdir = self.rawvfs.readdir | ||||
while visit: | while visit: | ||||
p = visit.pop() | p = visit.pop() | ||||
for f, kind, st in readdir(p, stat=True): | for f, kind, st in readdir(p, stat=True): | ||||
fp = p + '/' + f | fp = p + '/' + f | ||||
if kind == stat.S_IFREG and f[-2:] in ('.d', '.i'): | if filefilter(f, kind, st): | ||||
n = util.pconvert(fp[striplen:]) | n = util.pconvert(fp[striplen:]) | ||||
l.append((decodedir(n), n, st.st_size)) | l.append((decodedir(n), n, st.st_size)) | ||||
elif kind == stat.S_IFDIR and recurse: | elif kind == stat.S_IFDIR and recurse: | ||||
visit.append(fp) | visit.append(fp) | ||||
l.sort() | l.sort() | ||||
return l | return l | ||||
def datafiles(self): | def datafiles(self): |