Mercurial > hg
comparison hgext/inotify/server.py @ 8555:3e09bc5fee12
inotify: introduce debuginotify, which lists which paths are under watch
author | Nicolas Dumazet <nicdumz.commits@gmail.com> |
---|---|
date | Wed, 22 Apr 2009 00:37:35 +0900 |
parents | 47d7347484f5 |
children | 67f76a4463ef |
comparison
equal
deleted
inserted
replaced
8554:47d7347484f5 | 8555:3e09bc5fee12 |
---|---|
540 self.timeout = None | 540 self.timeout = None |
541 | 541 |
542 def shutdown(self): | 542 def shutdown(self): |
543 self.watcher.close() | 543 self.watcher.close() |
544 | 544 |
545 def debug(self): | |
546 """ | |
547 Returns a sorted list of relatives paths currently watched, | |
548 for debugging purposes. | |
549 """ | |
550 return sorted(tuple[0][len(self.wprefix):] for tuple in self.watcher) | |
551 | |
545 class server(object): | 552 class server(object): |
546 poll_events = select.POLLIN | 553 poll_events = select.POLLIN |
547 | 554 |
548 def __init__(self, ui, repo, repowatcher, timeout): | 555 def __init__(self, ui, repo, repowatcher, timeout): |
549 self.ui = ui | 556 self.ui = ui |
622 or [], | 629 or [], |
623 [], | 630 [], |
624 'c' in states and genresult('n', self.repowatcher.tree) or [], | 631 'c' in states and genresult('n', self.repowatcher.tree) or [], |
625 ]] | 632 ]] |
626 | 633 |
634 def answer_dbug_query(self): | |
635 return ['\0'.join(self.repowatcher.debug())] | |
636 | |
627 def handle_event(self, fd, event): | 637 def handle_event(self, fd, event): |
628 sock, addr = self.sock.accept() | 638 sock, addr = self.sock.accept() |
629 | 639 |
630 cs = common.recvcs(sock) | 640 cs = common.recvcs(sock) |
631 version = ord(cs.read(1)) | 641 version = ord(cs.read(1)) |
637 | 647 |
638 type = cs.read(4) | 648 type = cs.read(4) |
639 | 649 |
640 if type == 'STAT': | 650 if type == 'STAT': |
641 results = self.answer_stat_query(cs) | 651 results = self.answer_stat_query(cs) |
652 elif type == 'DBUG': | |
653 results = self.answer_dbug_query() | |
642 else: | 654 else: |
643 self.ui.warn(_('unrecognized query type: %s\n') % type) | 655 self.ui.warn(_('unrecognized query type: %s\n') % type) |
644 return | 656 return |
645 | 657 |
646 try: | 658 try: |