# HG changeset patch # User Nicolas Dumazet # Date 2009-05-04 08:58:26 # Node ID b923d599c309babe018e01cf1a93e2a21364e75c # Parent 589a82fb02a2ce865bf51026c79ee35da69d4d10 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 diff --git a/hgext/inotify/server.py b/hgext/inotify/server.py --- a/hgext/inotify/server.py +++ b/hgext/inotify/server.py @@ -35,12 +35,10 @@ def walkrepodirs(repo): 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 @@ def walkrepodirs(repo): 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 walk(repo, root): 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 @@ def walk(repo, root): 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)