Skip to content
Snippets Groups Projects
Commit a1305c1c authored by Nicolas Dumazet's avatar Nicolas Dumazet
Browse files

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.
parent 1c5d93b2
No related branches found
No related tags found
No related merge requests found
......@@ -78,11 +78,11 @@
dirs.append(name)
elif kind in (stat.S_IFREG, stat.S_IFLNK):
files.append((name, kind))
yield hginside, fullpath, dirs, files
if reporoot or not hginside:
yield fullpath, dirs, files
for subdir in dirs:
path = join(root, subdir)
if repo.dirstate._ignore(path):
continue
for result in walkit(path, False):
......@@ -83,11 +83,10 @@
for subdir in dirs:
path = join(root, subdir)
if repo.dirstate._ignore(path):
continue
for result in walkit(path, False):
if not result[0]:
yield result
yield result
except OSError, err:
if err.errno not in walk_ignored_errors:
raise
......@@ -91,8 +90,8 @@
except OSError, err:
if err.errno not in walk_ignored_errors:
raise
for result in walkit(root, root == ''):
yield result[1:]
return walkit(root, root == '')
def _explain_watch_limit(ui, repo, count):
path = '/proc/sys/fs/inotify/max_user_watches'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment