changeset 8787:9aca76502280

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.
author Nicolas Dumazet <nicdumz.commits@gmail.com>
date Wed, 27 May 2009 00:29:11 +0900
parents 55af9be4efac
children 5d8021ac0e19
files hgext/inotify/server.py
diffstat 1 files changed, 8 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- 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]