inotify: server.walk(): use yield instead of for
authorNicolas Dumazet <nicdumz.commits@gmail.com>
Mon, 04 May 2009 18:19:26 +0900
changeset 8381 f52fcc864df4
parent 8380 a00a4db76a15
child 8382 6f44b1adc948
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
hgext/inotify/server.py
--- a/hgext/inotify/server.py	Thu May 14 10:59:55 2009 +0200
+++ b/hgext/inotify/server.py	Mon May 04 18:19:26 2009 +0900
@@ -73,16 +73,15 @@
                             return
                     else:
                         dirs.append(name)
+                        path = join(root, name)
+                        if repo.dirstate._ignore(path):
+                            continue
+                        for result in walkit(path, False):
+                            yield result
                 elif kind in (stat.S_IFREG, stat.S_IFLNK):
                     files.append(name)
             yield fullpath, dirs, files
 
-            for subdir in dirs:
-                path = join(root, subdir)
-                if repo.dirstate._ignore(path):
-                    continue
-                for result in walkit(path, False):
-                    yield result
         except OSError, err:
             if err.errno not in walk_ignored_errors:
                 raise