diff hgext/inotify/client.py @ 9854:95e1867f765b

inotify: mark directories visited during lookup (issue1844) Emulate the match.dir calls that are made in dirstate.walk: * first mark the visited directories on the server side * then extend the transmitted response to include this directory list * and lastly call match.dir on each directory
author Nicolas Dumazet <nicdumz.commits@gmail.com>
date Fri, 13 Nov 2009 08:31:10 +0900
parents 7c01599dd340
children 8939900073a8
line wrap: on
line diff
--- a/hgext/inotify/client.py	Fri Nov 13 06:36:26 2009 +0100
+++ b/hgext/inotify/client.py	Fri Nov 13 08:31:10 2009 +0900
@@ -150,7 +150,16 @@
                 if names:
                     return filter(match, names.split('\0'))
             return []
-        return map(readnames, resphdr)
+        results = map(readnames, resphdr[:-1])
+
+        if names:
+            nbytes = resphdr[-1]
+            vdirs = cs.read(nbytes)
+            if vdirs:
+                for vdir in vdirs.split('\0'):
+                    match.dir(vdir)
+
+        return results
 
     @start_server
     def debugquery(self):