comparison hgext/inotify/server.py @ 8381:f52fcc864df4

inotify: server.walk(): use yield instead of for iterate on subdir when the directory is found, not once all the directories are found, since yield order doesn't matter
author Nicolas Dumazet <nicdumz.commits@gmail.com>
date Mon, 04 May 2009 18:19:26 +0900
parents 114f067229bd
children 6f44b1adc948
comparison
equal deleted inserted replaced
8380:a00a4db76a15 8381:f52fcc864df4
71 if name == '.hg': 71 if name == '.hg':
72 if not reporoot: 72 if not reporoot:
73 return 73 return
74 else: 74 else:
75 dirs.append(name) 75 dirs.append(name)
76 path = join(root, name)
77 if repo.dirstate._ignore(path):
78 continue
79 for result in walkit(path, False):
80 yield result
76 elif kind in (stat.S_IFREG, stat.S_IFLNK): 81 elif kind in (stat.S_IFREG, stat.S_IFLNK):
77 files.append(name) 82 files.append(name)
78 yield fullpath, dirs, files 83 yield fullpath, dirs, files
79 84
80 for subdir in dirs:
81 path = join(root, subdir)
82 if repo.dirstate._ignore(path):
83 continue
84 for result in walkit(path, False):
85 yield result
86 except OSError, err: 85 except OSError, err:
87 if err.errno not in walk_ignored_errors: 86 if err.errno not in walk_ignored_errors:
88 raise 87 raise
89 88
90 return walkit(root, root == '') 89 return walkit(root, root == '')