Mercurial > hg
comparison hgext/inotify/server.py @ 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 | 578f2a0049cd |
comparison
equal
deleted
inserted
replaced
8599:1f706b1b62f3 | 8600:d46cdfcecaf1 |
---|---|
309 dd = self.dir(self.statustrees[newstatus], root) | 309 dd = self.dir(self.statustrees[newstatus], root) |
310 if oldstatus != newstatus or fn not in dd: | 310 if oldstatus != newstatus or fn not in dd: |
311 dd[fn] = newstatus | 311 dd[fn] = newstatus |
312 else: | 312 else: |
313 d.pop(fn, None) | 313 d.pop(fn, None) |
314 elif not newstatus: | |
315 # a directory is being removed, check its contents | |
316 for subfile, b in oldstatus.copy().iteritems(): | |
317 self._updatestatus(wfn + '/' + subfile, None) | |
318 | 314 |
319 | 315 |
320 def check_deleted(self, key): | 316 def check_deleted(self, key): |
321 # Files that had been deleted but were present in the dirstate | 317 # Files that had been deleted but were present in the dirstate |
322 # may have vanished from the dirstate; we must clean them up. | 318 # may have vanished from the dirstate; we must clean them up. |
481 if self.ui.debugflag: | 477 if self.ui.debugflag: |
482 self.ui.note(_('%s event: deleted %s\n') % | 478 self.ui.note(_('%s event: deleted %s\n') % |
483 (self.event_time(), wpath)) | 479 (self.event_time(), wpath)) |
484 | 480 |
485 if evt.mask & inotify.IN_ISDIR: | 481 if evt.mask & inotify.IN_ISDIR: |
482 tree = self.dir(self.tree, wpath).copy() | |
483 for wfn, ignore in self.walk('?', tree): | |
484 self.deletefile(join(wpath, wfn), '?') | |
486 self.scan(wpath) | 485 self.scan(wpath) |
487 self.schedule_work(wpath, 'd') | 486 else: |
487 self.schedule_work(wpath, 'd') | |
488 | 488 |
489 def process_modify(self, wpath, evt): | 489 def process_modify(self, wpath, evt): |
490 if self.ui.debugflag: | 490 if self.ui.debugflag: |
491 self.ui.note(_('%s event: modified %s\n') % | 491 self.ui.note(_('%s event: modified %s\n') % |
492 (self.event_time(), wpath)) | 492 (self.event_time(), wpath)) |