changeset 8324:b923d599c309

inotify: inotify.server.walk*() remove unnecessary var Remove hginside var and the test it relates to: not( top or not hginside ) == (not top) and hginside, so the only case when nothing will be yielded is when hginside is True and top is False. Because of the returns placed upstream, this case will not happen anymore. We can then safely remove hginside and the (if)s
author Nicolas Dumazet <nicdumz.commits@gmail.com>
date Mon, 04 May 2009 17:58:26 +0900
parents 589a82fb02a2
children f2559645643a
files hgext/inotify/server.py
diffstat 1 files changed, 2 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/inotify/server.py	Mon May 04 17:17:03 2009 +0900
+++ b/hgext/inotify/server.py	Mon May 04 17:58:26 2009 +0900
@@ -35,12 +35,10 @@
 
     def walkit(dirname, top):
         fullpath = rootslash + dirname
-        hginside = False
         try:
             for name, kind in osutil.listdir(fullpath):
                 if kind == stat.S_IFDIR:
                     if name == '.hg':
-                        hginside = True
                         if not top:
                             return
                     else:
@@ -52,8 +50,7 @@
         except OSError, err:
             if err.errno not in walk_ignored_errors:
                 raise
-        if top or not hginside:
-            yield fullpath
+        yield fullpath
 
     return walkit('', True)
 
@@ -66,14 +63,12 @@
 
     def walkit(root, reporoot):
         files, dirs = [], []
-        hginside = False
 
         try:
             fullpath = rootslash + root
             for name, kind in osutil.listdir(fullpath):
                 if kind == stat.S_IFDIR:
                     if name == '.hg':
-                        hginside = True
                         if reporoot:
                             continue
                         else:
@@ -81,8 +76,7 @@
                     dirs.append(name)
                 elif kind in (stat.S_IFREG, stat.S_IFLNK):
                     files.append((name, kind))
-            if reporoot or not hginside:
-                yield fullpath, dirs, files
+            yield fullpath, dirs, files
 
             for subdir in dirs:
                 path = join(root, subdir)