diff hgext/inotify/server.py @ 7892:67e59a9886d5

Fixing issue1542, adding a relevant test inotify is smart enough to notify you about any changes in a directory, even if you only watch the directory, and none if its contents: the recursive add_watch I added was unnecessary. The only thing that matters here is the recursive status update on directory deletion. And scan() has to be called _before_ the deferred call is registered. (race condition: depending on the times, the previous patch could apparently fail on the provided test. It's not the case anymore.)
author Nicolas Dumazet <nicdumz.commits@gmail.com>
date Thu, 26 Mar 2009 19:01:06 +0900
parents fca9947652ce
children a1a5a57efe90
line wrap: on
line diff
--- a/hgext/inotify/server.py	Wed Mar 11 20:28:09 2009 +0100
+++ b/hgext/inotify/server.py	Thu Mar 26 19:01:06 2009 +0900
@@ -304,6 +304,11 @@
                         dd[fn] = status
             else:
                 d.pop(fn, None)
+        elif not status:
+            # a directory is being removed, check its contents
+            for subfile, b in oldstatus.copy().iteritems():
+                self.updatestatus(wfn + '/' + subfile, None)
+
 
     def check_deleted(self, key):
         # Files that had been deleted but were present in the dirstate
@@ -473,8 +478,7 @@
 
         if evt.mask & inotify.IN_ISDIR:
             self.scan(wpath)
-        else:
-            self.schedule_work(wpath, 'd')
+        self.schedule_work(wpath, 'd')
 
     def process_modify(self, wpath, evt):
         if self.ui.debugflag: