Show More
@@ -151,8 +151,7 b' class repowatcher(object):' | |||
|
151 | 151 | self.watches = 0 |
|
152 | 152 | self.last_event = None |
|
153 | 153 | |
|
154 |
self.event |
|
|
155 | self.deferred = 0 | |
|
154 | self.lastevent = {} | |
|
156 | 155 | |
|
157 | 156 | self.ds_info = self.dirstate_info() |
|
158 | 157 | self.handle_timeout() |
@@ -447,24 +446,21 b' class repowatcher(object):' | |||
|
447 | 446 | |
|
448 | 447 | self.deletefile(wpath, self.repo.dirstate[wpath]) |
|
449 | 448 | |
|
450 |
def |
|
|
451 | prev = self.eventq.setdefault(wpath, []) | |
|
449 | def work(self, wpath, evt): | |
|
452 | 450 | try: |
|
453 |
if |
|
|
454 |
|
|
|
455 | self.eventq[wpath].append(evt) | |
|
451 | if evt == 'c': | |
|
452 | self.created(wpath) | |
|
453 | elif evt == 'm': | |
|
454 | if wpath in self.lastevent and self.lastevent[wpath] in 'cm': | |
|
455 | return | |
|
456 | self.modified(wpath) | |
|
457 | elif evt == 'd': | |
|
458 | self.deleted(wpath) | |
|
459 | ||
|
460 | self.lastevent[wpath] = evt | |
|
456 | 461 | finally: |
|
457 | self.deferred += 1 | |
|
458 | 462 | self.timeout = 250 |
|
459 | 463 | |
|
460 | def deferred_event(self, wpath, evt): | |
|
461 | if evt == 'c': | |
|
462 | self.created(wpath) | |
|
463 | elif evt == 'm': | |
|
464 | self.modified(wpath) | |
|
465 | elif evt == 'd': | |
|
466 | self.deleted(wpath) | |
|
467 | ||
|
468 | 464 | def process_create(self, wpath, evt): |
|
469 | 465 | if self.ui.debugflag: |
|
470 | 466 | self.ui.note(_('%s event: created %s\n') % |
@@ -473,7 +469,7 b' class repowatcher(object):' | |||
|
473 | 469 | if evt.mask & inotify.IN_ISDIR: |
|
474 | 470 | self.scan(wpath) |
|
475 | 471 | else: |
|
476 |
self. |
|
|
472 | self.work(wpath, 'c') | |
|
477 | 473 | |
|
478 | 474 | def process_delete(self, wpath, evt): |
|
479 | 475 | if self.ui.debugflag: |
@@ -486,7 +482,7 b' class repowatcher(object):' | |||
|
486 | 482 | self.deletefile(join(wpath, wfn), '?') |
|
487 | 483 | self.scan(wpath) |
|
488 | 484 | else: |
|
489 |
self. |
|
|
485 | self.work(wpath, 'd') | |
|
490 | 486 | |
|
491 | 487 | def process_modify(self, wpath, evt): |
|
492 | 488 | if self.ui.debugflag: |
@@ -494,7 +490,7 b' class repowatcher(object):' | |||
|
494 | 490 | (self.event_time(), wpath)) |
|
495 | 491 | |
|
496 | 492 | if not (evt.mask & inotify.IN_ISDIR): |
|
497 |
self. |
|
|
493 | self.work(wpath, 'm') | |
|
498 | 494 | |
|
499 | 495 | def process_unmount(self, evt): |
|
500 | 496 | self.ui.warn(_('filesystem containing %s was unmounted\n') % |
@@ -533,6 +529,8 b' class repowatcher(object):' | |||
|
533 | 529 | elif evt.mask & (inotify.IN_CREATE | inotify.IN_MOVED_TO): |
|
534 | 530 | self.process_create(wpath, evt) |
|
535 | 531 | |
|
532 | self.lastevent.clear() | |
|
533 | ||
|
536 | 534 | def handle_timeout(self): |
|
537 | 535 | if not self.registered: |
|
538 | 536 | if self.ui.debugflag: |
@@ -542,16 +540,6 b' class repowatcher(object):' | |||
|
542 | 540 | self.master.poll.register(self, select.POLLIN) |
|
543 | 541 | self.registered = True |
|
544 | 542 | |
|
545 | if self.eventq: | |
|
546 | if self.ui.debugflag: | |
|
547 | self.ui.note(_('%s processing %d deferred events as %d\n') % | |
|
548 | (self.event_time(), self.deferred, | |
|
549 | len(self.eventq))) | |
|
550 | for wpath, evts in sorted(self.eventq.iteritems()): | |
|
551 | for evt in evts: | |
|
552 | self.deferred_event(wpath, evt) | |
|
553 | self.eventq.clear() | |
|
554 | self.deferred = 0 | |
|
555 | 543 | self.timeout = None |
|
556 | 544 | |
|
557 | 545 | def shutdown(self): |
General Comments 0
You need to be logged in to leave comments.
Login now