Mercurial > hg
comparison hgext/inotify/server.py @ 8607:e17eba98c789
inotify: handle_event: do not use event and fd parameters.
event is particularly confusing given the context (is it an inotify event?
a polling event?) and is never used. Remove it.
fd has very little use, and it gives the false impression that event handling
depends on fd. It's wrong: the same behavior is triggered, for all events.
author | Nicolas Dumazet <nicdumz.commits@gmail.com> |
---|---|
date | Thu, 21 May 2009 16:54:05 +0900 |
parents | 1c5752dabf76 |
children | 228db070bfc4 |
comparison
equal
deleted
inserted
replaced
8606:1c5752dabf76 | 8607:e17eba98c789 |
---|---|
498 def process_unmount(self, evt): | 498 def process_unmount(self, evt): |
499 self.ui.warn(_('filesystem containing %s was unmounted\n') % | 499 self.ui.warn(_('filesystem containing %s was unmounted\n') % |
500 evt.fullpath) | 500 evt.fullpath) |
501 sys.exit(0) | 501 sys.exit(0) |
502 | 502 |
503 def handle_event(self, fd, event): | 503 def handle_event(self): |
504 if self.ui.debugflag: | 504 if self.ui.debugflag: |
505 self.ui.note(_('%s readable: %d bytes\n') % | 505 self.ui.note(_('%s readable: %d bytes\n') % |
506 (self.event_time(), self.threshold.readable())) | 506 (self.event_time(), self.threshold.readable())) |
507 if not self.threshold(): | 507 if not self.threshold(): |
508 if self.registered: | 508 if self.registered: |
509 if self.ui.debugflag: | 509 if self.ui.debugflag: |
510 self.ui.note(_('%s below threshold - unhooking\n') % | 510 self.ui.note(_('%s below threshold - unhooking\n') % |
511 (self.event_time())) | 511 (self.event_time())) |
512 self.master.poll.unregister(fd) | 512 self.master.poll.unregister(self.fileno()) |
513 self.registered = False | 513 self.registered = False |
514 self.timeout = 250 | 514 self.timeout = 250 |
515 else: | 515 else: |
516 self.read_events() | 516 self.read_events() |
517 | 517 |
638 ]] | 638 ]] |
639 | 639 |
640 def answer_dbug_query(self): | 640 def answer_dbug_query(self): |
641 return ['\0'.join(self.repowatcher.debug())] | 641 return ['\0'.join(self.repowatcher.debug())] |
642 | 642 |
643 def handle_event(self, fd, event): | 643 def handle_event(self): |
644 sock, addr = self.sock.accept() | 644 sock, addr = self.sock.accept() |
645 | 645 |
646 cs = common.recvcs(sock) | 646 cs = common.recvcs(sock) |
647 version = ord(cs.read(1)) | 647 version = ord(cs.read(1)) |
648 | 648 |
727 if err[0] == errno.EINTR: | 727 if err[0] == errno.EINTR: |
728 continue | 728 continue |
729 raise | 729 raise |
730 if events: | 730 if events: |
731 for fd, event in events: | 731 for fd, event in events: |
732 self.table[fd].handle_event(fd, event) | 732 self.table[fd].handle_event() |
733 elif timeobj: | 733 elif timeobj: |
734 timeobj.handle_timeout() | 734 timeobj.handle_timeout() |
735 | 735 |
736 def start(ui, repo): | 736 def start(ui, repo): |
737 def closefds(ignore): | 737 def closefds(ignore): |