inotify: server: move split() out of server
authorNicolas Dumazet <nicdumz.commits@gmail.com>
Wed, 27 May 2009 00:29:11 +0900
changeset 8787 9aca76502280
parent 8786 55af9be4efac
child 8788 5d8021ac0e19
inotify: server: move split() out of server split() has nothing to do with the server logic, it does not need to be in the class. Move it on top, next to join() which does the opposite.
hgext/inotify/server.py
--- a/hgext/inotify/server.py	Sat Jun 13 17:23:08 2009 +0200
+++ b/hgext/inotify/server.py	Wed May 27 00:29:11 2009 +0900
@@ -26,6 +26,12 @@
         return a + '/' + b
     return b
 
+def split(path):
+    c = path.rfind('/')
+    if c == -1:
+        return '', path
+    return path[:c], path[c+1:]
+
 walk_ignored_errors = (errno.ENOENT, errno.ENAMETOOLONG)
 
 def walkrepodirs(repo):
@@ -251,12 +257,6 @@
                 return 'd'
         return tree
 
-    def split(self, path):
-        c = path.rfind('/')
-        if c == -1:
-            return '', path
-        return path[:c], path[c+1:]
-
     def filestatus(self, fn, st):
         try:
             type_, mode, size, time = self.repo.dirstate._map[fn][:4]
@@ -307,7 +307,7 @@
         newstatus: - char in (statuskeys + 'ni'), new status to apply.
                    - or None, to stop tracking wfn
         '''
-        root, fn = self.split(wfn)
+        root, fn = split(wfn)
         d = self.dir(self.tree, root)
 
         oldstatus = d.get(fn)
@@ -346,7 +346,7 @@
             if wfn not in self.repo.dirstate:
                 nuke.append(wfn)
         for wfn in nuke:
-            root, fn = self.split(wfn)
+            root, fn = split(wfn)
             del self.dir(self.statustrees[key], root)[fn]
             del self.dir(self.tree, root)[fn]