Show More
@@ -15,6 +15,7 b' from mercurial.i18n import _' | |||||
15 |
|
15 | |||
16 | from mercurial import ( |
|
16 | from mercurial import ( | |
17 | error, |
|
17 | error, | |
|
18 | pathutil, | |||
18 | url as urlmod, |
|
19 | url as urlmod, | |
19 | util, |
|
20 | util, | |
20 | vfs as vfsmod, |
|
21 | vfs as vfsmod, | |
@@ -32,6 +33,28 b' class lfsvfs(vfsmod.vfs):' | |||||
32 | raise error.ProgrammingError('unexpected lfs path: %s' % path) |
|
33 | raise error.ProgrammingError('unexpected lfs path: %s' % path) | |
33 | return super(lfsvfs, self).join(path[0:2], path[2:]) |
|
34 | return super(lfsvfs, self).join(path[0:2], path[2:]) | |
34 |
|
35 | |||
|
36 | def walk(self, path=None, onerror=None): | |||
|
37 | """Yield (dirpath, '', oids) tuple for blobs under path | |||
|
38 | ||||
|
39 | Oids only exist in the root of this vfs, so dirpath is always ''. | |||
|
40 | """ | |||
|
41 | root = os.path.normpath(self.base) | |||
|
42 | # when dirpath == root, dirpath[prefixlen:] becomes empty | |||
|
43 | # because len(dirpath) < prefixlen. | |||
|
44 | prefixlen = len(pathutil.normasprefix(root)) | |||
|
45 | oids = [] | |||
|
46 | ||||
|
47 | for dirpath, dirs, files in os.walk(self.reljoin(self.base, path or ''), | |||
|
48 | onerror=onerror): | |||
|
49 | dirpath = dirpath[prefixlen:] | |||
|
50 | ||||
|
51 | # Silently skip unexpected files and directories | |||
|
52 | if len(dirpath) == 2: | |||
|
53 | oids.extend([dirpath + f for f in files | |||
|
54 | if _lfsre.match(dirpath + f)]) | |||
|
55 | ||||
|
56 | yield ('', '', oids) | |||
|
57 | ||||
35 | class filewithprogress(object): |
|
58 | class filewithprogress(object): | |
36 | """a file-like object that supports __len__ and read. |
|
59 | """a file-like object that supports __len__ and read. | |
37 |
|
60 |
General Comments 0
You need to be logged in to leave comments.
Login now