comparison hgext/inotify/server.py @ 8320:a1305c1c8d8e

inotify: inotify.server.walk() simplify algorithm Do not yield (bool, tuple) in a subfunction and check later: 'if not bool: yield tuple'. Instead simplify so the tuple doesnt get yielded on the first time, to avoid systematic checks.
author Nicolas Dumazet <nicdumz.commits@gmail.com>
date Mon, 04 May 2009 16:57:52 +0900
parents 1c5d93b225f7
children ec985dcfd7da
comparison
equal deleted inserted replaced
8319:1c5d93b225f7 8320:a1305c1c8d8e
76 else: 76 else:
77 break 77 break
78 dirs.append(name) 78 dirs.append(name)
79 elif kind in (stat.S_IFREG, stat.S_IFLNK): 79 elif kind in (stat.S_IFREG, stat.S_IFLNK):
80 files.append((name, kind)) 80 files.append((name, kind))
81 81 if reporoot or not hginside:
82 yield hginside, fullpath, dirs, files 82 yield fullpath, dirs, files
83 83
84 for subdir in dirs: 84 for subdir in dirs:
85 path = join(root, subdir) 85 path = join(root, subdir)
86 if repo.dirstate._ignore(path): 86 if repo.dirstate._ignore(path):
87 continue 87 continue
88 for result in walkit(path, False): 88 for result in walkit(path, False):
89 if not result[0]: 89 yield result
90 yield result
91 except OSError, err: 90 except OSError, err:
92 if err.errno not in walk_ignored_errors: 91 if err.errno not in walk_ignored_errors:
93 raise 92 raise
94 for result in walkit(root, root == ''): 93
95 yield result[1:] 94 return walkit(root, root == '')
96 95
97 def _explain_watch_limit(ui, repo, count): 96 def _explain_watch_limit(ui, repo, count):
98 path = '/proc/sys/fs/inotify/max_user_watches' 97 path = '/proc/sys/fs/inotify/max_user_watches'
99 try: 98 try:
100 limit = int(file(path).read()) 99 limit = int(file(path).read())