changeset 8600:d46cdfcecaf1

inotify: proper fix for issue1542 (partially reverting 67e59a9886d5) issue1542 description: Unknown files (?) placed in a directory are still marked as present and unknown when the containing directory is moved out of the repository scope. Why 67e59a9886d5 was bad: * When the problem we're addressing only deals with unknown files, the fix to updatestatus applies for all statuses * The only reason to move the call schedule_work(wpath, 'd') seems to be that it allowed an updatestatus call on the deleted directory, in deleted(). But deleted() should not be called on directories in the first place. * After fixing an independant issue (1371), test-inotify-issue1542 was failing Fix: When processing a deletion of a directory, walk the tree of the unknown files and remove the entries from repowatcher. This step does not need to be added in the generic scan() routine: it is only necessary on a directory deletion.
author Nicolas Dumazet <nicdumz.commits@gmail.com>
date Sat, 23 May 2009 18:44:01 +0900
parents 1f706b1b62f3
children 021de2d12355
files hgext/inotify/server.py
diffstat 1 files changed, 5 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/inotify/server.py	Sun May 24 18:43:05 2009 +0900
+++ b/hgext/inotify/server.py	Sat May 23 18:44:01 2009 +0900
@@ -311,10 +311,6 @@
                         dd[fn] = newstatus
             else:
                 d.pop(fn, None)
-        elif not newstatus:
-            # 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):
@@ -483,8 +479,12 @@
                          (self.event_time(), wpath))
 
         if evt.mask & inotify.IN_ISDIR:
+            tree = self.dir(self.tree, wpath).copy()
+            for wfn, ignore in self.walk('?', tree):
+                self.deletefile(join(wpath, wfn), '?')
             self.scan(wpath)
-        self.schedule_work(wpath, 'd')
+        else:
+            self.schedule_work(wpath, 'd')
 
     def process_modify(self, wpath, evt):
         if self.ui.debugflag: