hgext/inotify/server.py
changeset 8555 3e09bc5fee12
parent 8554 47d7347484f5
child 8557 67f76a4463ef
--- a/hgext/inotify/server.py	Wed Apr 22 00:23:40 2009 +0900
+++ b/hgext/inotify/server.py	Wed Apr 22 00:37:35 2009 +0900
@@ -542,6 +542,13 @@
     def shutdown(self):
         self.watcher.close()
 
+    def debug(self):
+        """
+        Returns a sorted list of relatives paths currently watched,
+        for debugging purposes.
+        """
+        return sorted(tuple[0][len(self.wprefix):] for tuple in self.watcher)
+
 class server(object):
     poll_events = select.POLLIN
 
@@ -624,6 +631,9 @@
             'c' in states and genresult('n', self.repowatcher.tree) or [],
             ]]
 
+    def answer_dbug_query(self):
+        return ['\0'.join(self.repowatcher.debug())]
+
     def handle_event(self, fd, event):
         sock, addr = self.sock.accept()
 
@@ -639,6 +649,8 @@
 
         if type == 'STAT':
             results = self.answer_stat_query(cs)
+        elif type == 'DBUG':
+            results = self.answer_dbug_query()
         else:
             self.ui.warn(_('unrecognized query type: %s\n') % type)
             return