##// END OF EJS Templates
inotify: do not rely on stat(.hg/dirstate) to invalidate our dirstate...
Nicolas Dumazet -
r10090:a3ad96ea default
parent child Browse files
Show More
@@ -170,6 +170,7 b' class repowatcher(server.repowatcher, po'
170 server.repowatcher.__init__(self, ui, dirstate, root)
170 server.repowatcher.__init__(self, ui, dirstate, root)
171
171
172 self.lastevent = {}
172 self.lastevent = {}
173 self.dirty = False
173 try:
174 try:
174 self.watcher = watcher.watcher()
175 self.watcher = watcher.watcher()
175 except OSError, err:
176 except OSError, err:
@@ -214,7 +215,6 b' class repowatcher(server.repowatcher, po'
214 def setup(self):
215 def setup(self):
215 self.ui.note(_('watching directories under %r\n') % self.wprefix)
216 self.ui.note(_('watching directories under %r\n') % self.wprefix)
216 self.add_watch(self.wprefix + '.hg', inotify.IN_DELETE)
217 self.add_watch(self.wprefix + '.hg', inotify.IN_DELETE)
217 self.check_dirstate()
218
218
219 def scan(self, topdir=''):
219 def scan(self, topdir=''):
220 ds = self.dirstate._map.copy()
220 ds = self.dirstate._map.copy()
@@ -272,8 +272,6 b' class repowatcher(server.repowatcher, po'
272 if wpath == '.hgignore':
272 if wpath == '.hgignore':
273 self.update_hgignore()
273 self.update_hgignore()
274 elif wpath.startswith('.hg/'):
274 elif wpath.startswith('.hg/'):
275 if wpath == '.hg/wlock':
276 self.check_dirstate()
277 return
275 return
278
276
279 self.deletefile(wpath, self.dirstate[wpath])
277 self.deletefile(wpath, self.dirstate[wpath])
@@ -343,16 +341,26 b' class repowatcher(server.repowatcher, po'
343 if wpath.startswith('.hg/') and evt.mask & inotify.IN_ISDIR:
341 if wpath.startswith('.hg/') and evt.mask & inotify.IN_ISDIR:
344 # ignore subdirectories of .hg/ (merge, patches...)
342 # ignore subdirectories of .hg/ (merge, patches...)
345 continue
343 continue
344 if wpath == ".hg/wlock":
345 if evt.mask & inotify.IN_DELETE:
346 self.dirstate.invalidate()
347 self.dirty = False
348 self.scan()
349 elif evt.mask & inotify.IN_CREATE:
350 self.dirty = True
351 else:
352 if self.dirty:
353 continue
346
354
347 if evt.mask & inotify.IN_UNMOUNT:
355 if evt.mask & inotify.IN_UNMOUNT:
348 self.process_unmount(wpath, evt)
356 self.process_unmount(wpath, evt)
349 elif evt.mask & (inotify.IN_MODIFY | inotify.IN_ATTRIB):
357 elif evt.mask & (inotify.IN_MODIFY | inotify.IN_ATTRIB):
350 self.process_modify(wpath, evt)
358 self.process_modify(wpath, evt)
351 elif evt.mask & (inotify.IN_DELETE | inotify.IN_DELETE_SELF |
359 elif evt.mask & (inotify.IN_DELETE | inotify.IN_DELETE_SELF |
352 inotify.IN_MOVED_FROM):
360 inotify.IN_MOVED_FROM):
353 self.process_delete(wpath, evt)
361 self.process_delete(wpath, evt)
354 elif evt.mask & (inotify.IN_CREATE | inotify.IN_MOVED_TO):
362 elif evt.mask & (inotify.IN_CREATE | inotify.IN_MOVED_TO):
355 self.process_create(wpath, evt)
363 self.process_create(wpath, evt)
356
364
357 self.lastevent.clear()
365 self.lastevent.clear()
358
366
@@ -281,17 +281,6 b' class repowatcher(object):'
281 del self.statustrees[key].dir(root).files[fn]
281 del self.statustrees[key].dir(root).files[fn]
282 del self.tree.dir(root).files[fn]
282 del self.tree.dir(root).files[fn]
283
283
284 def check_dirstate(self):
285 ds_info = self.dirstate_info()
286 if ds_info == self.ds_info:
287 return
288 self.ds_info = ds_info
289 if not self.ui.debugflag:
290 self.last_event = None
291 self.dirstate.invalidate()
292 self.handle_timeout()
293 self.scan()
294
295 def update_hgignore(self):
284 def update_hgignore(self):
296 # An update of the ignore file can potentially change the
285 # An update of the ignore file can potentially change the
297 # states of all unknown and ignored files.
286 # states of all unknown and ignored files.
General Comments 0
You need to be logged in to leave comments. Login now