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