equal
deleted
inserted
replaced
4 # |
4 # |
5 # This software may be used and distributed according to the terms of the |
5 # This software may be used and distributed according to the terms of the |
6 # GNU General Public License version 2 or any later version. |
6 # GNU General Public License version 2 or any later version. |
7 |
7 |
8 from i18n import _ |
8 from i18n import _ |
9 import osutil, scmutil, util, parsers |
9 import scmutil, util, parsers |
10 import os, stat, errno |
10 import os, stat, errno |
11 |
11 |
12 _sha = util.sha1 |
12 _sha = util.sha1 |
13 |
13 |
14 # This avoids a collision between a file named foo and a dir named |
14 # This avoids a collision between a file named foo and a dir named |
309 path += '/' + relpath |
309 path += '/' + relpath |
310 striplen = len(self.path) + 1 |
310 striplen = len(self.path) + 1 |
311 l = [] |
311 l = [] |
312 if self.rawvfs.isdir(path): |
312 if self.rawvfs.isdir(path): |
313 visit = [path] |
313 visit = [path] |
|
314 readdir = self.rawvfs.readdir |
314 while visit: |
315 while visit: |
315 p = visit.pop() |
316 p = visit.pop() |
316 for f, kind, st in osutil.listdir(p, stat=True): |
317 for f, kind, st in readdir(p, stat=True): |
317 fp = p + '/' + f |
318 fp = p + '/' + f |
318 if kind == stat.S_IFREG and f[-2:] in ('.d', '.i'): |
319 if kind == stat.S_IFREG and f[-2:] in ('.d', '.i'): |
319 n = util.pconvert(fp[striplen:]) |
320 n = util.pconvert(fp[striplen:]) |
320 l.append((decodedir(n), n, st.st_size)) |
321 l.append((decodedir(n), n, st.st_size)) |
321 elif kind == stat.S_IFDIR and recurse: |
322 elif kind == stat.S_IFDIR and recurse: |