Improved speed loading projects (with Mercurial).

Thu, 22 Apr 2010 18:14:32 +0000

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Thu, 22 Apr 2010 18:14:32 +0000
changeset 194
4820fc69705c
parent 193
10334355c3ae
child 195
2debcfe0e291

Improved speed loading projects (with Mercurial).

Plugins/VcsPlugins/vcsMercurial/hg.py file | annotate | diff | comparison | revisions
Project/ProjectBrowserModel.py file | annotate | diff | comparison | revisions
--- a/Plugins/VcsPlugins/vcsMercurial/hg.py	Thu Apr 22 17:47:29 2010 +0000
+++ b/Plugins/VcsPlugins/vcsMercurial/hg.py	Thu Apr 22 18:14:32 2010 +0000
@@ -784,6 +784,9 @@
         if fname == '.' and os.path.isdir(os.path.join(dname, self.adminDir)):
             return self.canBeCommitted
         
+        if name in self.statusCache:
+            return self.statusCache[name]
+        
         # find the root of the repo
         repodir = dname
         while not os.path.isdir(os.path.join(repodir, self.adminDir)):
@@ -837,10 +840,6 @@
         
         found = False
         for name in list(self.statusCache.keys()):
-##            if os.path.dirname(name) == dname:
-##                if shortcut:
-##                    found = True
-##                    break
             if name in names:
                 found = True
                 names[name] = self.statusCache[name]
@@ -870,17 +869,14 @@
                         str(process.readAllStandardOutput(), ioEncoding, 'replace')
                     for line in output.splitlines():
                         flag, path = line.split(" ", 1)
-                        name = os.path.join(repodir, os.path.normcase(path))
+                        name = os.path.join(repodir, os.path.normcase(path))
                         dirName = os.path.dirname(name)
                         if name.startswith(dname):
                             if flag not in "?I":
                                 if name in names:
                                     names[name] = self.canBeCommitted
-##                                dirName = os.path.dirname(name)
                                 if dirName in names:
                                     names[dirName] = self.canBeCommitted
-##                                self.statusCache[name] = self.canBeCommitted
-##                                self.statusCache[dirName] = self.canBeCommitted
                                 if dirs:
                                     for d in dirs:
                                         if name.startswith(d):
@@ -892,7 +888,6 @@
                             self.statusCache[dirName] = self.canBeCommitted
                         else:
                             self.statusCache[name] = self.canBeAdded
-##                            dirName = os.path.dirname(name)
                             if dirName not in self.statusCache:
                                 self.statusCache[dirName] = self.canBeAdded
         
--- a/Project/ProjectBrowserModel.py	Thu Apr 22 17:47:29 2010 +0000
+++ b/Project/ProjectBrowserModel.py	Thu Apr 22 18:14:32 2010 +0000
@@ -372,22 +372,7 @@
                     states[os.path.normcase(os.path.join(self.project.ppath, fn))] = 0
             
             self.project.vcs.clearStatusCache()
-            for dir in self.project.subdirs:
-                states = self.project.vcs.vcsAllRegisteredStates(states, 
-                    os.path.join(self.project.ppath, dir))
-            
-            for dir in self.project.otherssubdirs:
-                if not os.path.isabs(dir):
-                    dir = os.path.join(self.project.ppath, dir)
-                states = self.project.vcs.vcsAllRegisteredStates(states, dir)
-            
-            if self.project.pdata["TRANSLATIONPATTERN"]:
-                dir = os.path.join(self.project.ppath, 
-                                   self.project.pdata["TRANSLATIONPATTERN"][0])\
-                      .split("%language%")[0]
-                if not os.path.isdir(dir):
-                    dir = os.path.dirname(dir)
-                states = self.project.vcs.vcsAllRegisteredStates(states, dir)
+            states = self.project.vcs.vcsAllRegisteredStates(states, self.project.ppath)
         
         self.inRefresh = True
         for key in keys:

eric ide

mercurial