diff hgext/inotify/server.py @ 8953:e1d119f450f0

inotify: server: remove wpath method Only called once. And can be simplified to an easy oneliner.
author Nicolas Dumazet <nicdumz.commits@gmail.com>
date Sun, 28 Jun 2009 19:31:16 +0900
parents 7c7a672e9db7
children b55d44719b47
line wrap: on
line diff
--- a/hgext/inotify/server.py	Sun Jun 21 18:11:19 2009 +0200
+++ b/hgext/inotify/server.py	Sun Jun 28 19:31:16 2009 +0900
@@ -288,14 +288,6 @@
         self.add_watch(self.repo.path, inotify.IN_DELETE)
         self.check_dirstate()
 
-    def wpath(self, evt):
-        path = evt.fullpath
-        if path == self.repo.root:
-            return ''
-        if path.startswith(self.wprefix):
-            return path[len(self.wprefix):]
-        raise 'wtf? ' + path
-
     def dir(self, tree, path):
         if path:
             for name in path.split('/'):
@@ -585,7 +577,9 @@
             self.ui.note(_('%s reading %d events\n') %
                          (self.event_time(), len(events)))
         for evt in events:
-            wpath = self.wpath(evt)
+            assert evt.fullpath.startswith(self.wprefix)
+            wpath = evt.fullpath[len(self.wprefix):]
+
             if evt.mask & inotify.IN_UNMOUNT:
                 self.process_unmount(wpath, evt)
             elif evt.mask & (inotify.IN_MODIFY | inotify.IN_ATTRIB):