Show More
@@ -697,9 +697,6 b' class dirstate(object):' | |||
|
697 | 697 | if not skipstep3 and not exact: |
|
698 | 698 | visit = sorted([f for f in dmap if f not in results and matchfn(f)]) |
|
699 | 699 | for nf, st in zip(visit, util.statfiles([join(i) for i in visit])): |
|
700 | if (not st is None and | |
|
701 | getkind(st.st_mode) not in (regkind, lnkkind)): | |
|
702 | st = None | |
|
703 | 700 | results[nf] = st |
|
704 | 701 | for s in subrepos: |
|
705 | 702 | del results[s] |
@@ -352,12 +352,18 b' def findexe(command):' | |||
|
352 | 352 | def setsignalhandler(): |
|
353 | 353 | pass |
|
354 | 354 | |
|
355 | _wantedkinds = set([stat.S_IFREG, stat.S_IFLNK]) | |
|
356 | ||
|
355 | 357 | def statfiles(files): |
|
356 |
'Stat each file in files |
|
|
358 | '''Stat each file in files. Yield each stat, or None if a file does not | |
|
359 | exist or has a type we don't care about.''' | |
|
357 | 360 | lstat = os.lstat |
|
361 | getkind = stat.S_IFMT | |
|
358 | 362 | for nf in files: |
|
359 | 363 | try: |
|
360 | 364 | st = lstat(nf) |
|
365 | if getkind(st.st_mode) not in _wantedkinds: | |
|
366 | st = None | |
|
361 | 367 | except OSError, err: |
|
362 | 368 | if err.errno not in (errno.ENOENT, errno.ENOTDIR): |
|
363 | 369 | raise |
@@ -7,7 +7,7 b'' | |||
|
7 | 7 | |
|
8 | 8 | from i18n import _ |
|
9 | 9 | import osutil, encoding |
|
10 | import errno, msvcrt, os, re, sys, _winreg | |
|
10 | import errno, msvcrt, os, re, stat, sys, _winreg | |
|
11 | 11 | |
|
12 | 12 | import win32 |
|
13 | 13 | executablepath = win32.executablepath |
@@ -213,10 +213,15 b' def findexe(command):' | |||
|
213 | 213 | return executable |
|
214 | 214 | return findexisting(os.path.expanduser(os.path.expandvars(command))) |
|
215 | 215 | |
|
216 | _wantedkinds = set([stat.S_IFREG, stat.S_IFLNK]) | |
|
217 | ||
|
216 | 218 | def statfiles(files): |
|
217 |
'''Stat each file in files |
|
|
219 | '''Stat each file in files. Yield each stat, or None if a file | |
|
220 | does not exist or has a type we don't care about. | |
|
221 | ||
|
218 | 222 | Cluster and cache stat per directory to minimize number of OS stat calls.''' |
|
219 | 223 | dircache = {} # dirname -> filename -> status | None if file does not exist |
|
224 | getkind = stat.S_IFMT | |
|
220 | 225 | for nf in files: |
|
221 | 226 | nf = normcase(nf) |
|
222 | 227 | dir, base = os.path.split(nf) |
@@ -226,7 +231,8 b' def statfiles(files):' | |||
|
226 | 231 | if cache is None: |
|
227 | 232 | try: |
|
228 | 233 | dmap = dict([(normcase(n), s) |
|
229 |
for n, k, s in osutil.listdir(dir, True) |
|
|
234 | for n, k, s in osutil.listdir(dir, True) | |
|
235 | if getkind(s) in _wantedkinds]) | |
|
230 | 236 | except OSError, err: |
|
231 | 237 | # handle directory not found in Python version prior to 2.5 |
|
232 | 238 | # Python <= 2.4 returns native Windows code 3 in errno |
General Comments 0
You need to be logged in to leave comments.
Login now