diff hgext/inotify/server.py @ 8604:578f2a0049cd

inotify: do not recurse in handle_timeout(): call it explicitely, not in scan() When in handle_timeout, scan() is called when a repertory is created/modified. But the first line of scan calls handle_timeout. This had the consequence of calling recursively handle_timeout: * several calls to read_events (but only the first one retrieves events) * every time that an event is queued for a deferred action, the next time that scan() is called, handle_timeout is called, the event queue is treated, even if all the events haven't been read/queued yet. This could lead to inconsistencies
author Nicolas Dumazet <nicdumz.commits@gmail.com>
date Thu, 21 May 2009 15:55:58 +0900
parents d46cdfcecaf1
children ed2d9bdbfad2
line wrap: on
line diff
--- a/hgext/inotify/server.py	Sun May 24 17:07:27 2009 +0200
+++ b/hgext/inotify/server.py	Thu May 21 15:55:58 2009 +0900
@@ -155,6 +155,7 @@
         self.deferred = 0
 
         self.ds_info = self.dirstate_info()
+        self.handle_timeout()
         self.scan()
 
     def event_time(self):
@@ -326,7 +327,6 @@
             del self.dir(self.tree, root)[fn]
 
     def scan(self, topdir=''):
-        self.handle_timeout()
         ds = self.repo.dirstate._map.copy()
         self.add_watch(join(self.repo.root, topdir), self.mask)
         for root, dirs, files in walk(self.repo, topdir):
@@ -363,6 +363,7 @@
             self.last_event = None
         self.ui.note(_('%s dirstate reload\n') % self.event_time())
         self.repo.dirstate.invalidate()
+        self.handle_timeout()
         self.scan()
         self.ui.note(_('%s end dirstate reload\n') % self.event_time())
 
@@ -392,6 +393,7 @@
         if '_ignore' in self.repo.dirstate.__dict__:
             delattr(self.repo.dirstate, '_ignore')
             self.ui.note(_('rescanning due to .hgignore change\n'))
+            self.handle_timeout()
             self.scan()
 
     def getstat(self, wpath):