Changed code to improve speed of the Mercurial plugin for opening a project.

Thu, 22 Apr 2010 14:33:39 +0000

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Thu, 22 Apr 2010 14:33:39 +0000
changeset 192
2c1187ab98ce
parent 191
dccb19a7c52e
child 193
10334355c3ae

Changed code to improve speed of the Mercurial plugin for opening a project.

Plugins/VcsPlugins/vcsMercurial/hg.py file | annotate | diff | comparison | revisions
--- a/Plugins/VcsPlugins/vcsMercurial/hg.py	Tue Apr 20 19:50:37 2010 +0000
+++ b/Plugins/VcsPlugins/vcsMercurial/hg.py	Thu Apr 22 14:33:39 2010 +0000
@@ -837,13 +837,13 @@
         
         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]
+##            if os.path.dirname(name) == dname:
+##                if shortcut:
+##                    found = True
+##                    break
+            if name in names:
+                found = True
+                names[name] = self.statusCache[name]
         
         if not found:
             # find the root of the repo
@@ -870,27 +870,31 @@
                         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)
+##                                dirName = os.path.dirname(name)
                                 if dirName in names:
                                     names[dirName] = self.canBeCommitted
-                                self.statusCache[name] = self.canBeCommitted
-                                self.statusCache[dirName] = self.canBeCommitted
+##                                self.statusCache[name] = self.canBeCommitted
+##                                self.statusCache[dirName] = self.canBeCommitted
                                 if dirs:
                                     for d in dirs:
                                         if name.startswith(d):
                                             names[d] = self.canBeCommitted
                                             dirs.remove(d)
                                             break
-                            else:
-                                self.statusCache[name] = self.canBeAdded
-                                dirName = os.path.dirname(name)
-                                if dirName not in self.statusCache:
-                                    self.statusCache[dirName] = self.canBeAdded
+                        if flag not in "?I":
+                            self.statusCache[name] = self.canBeCommitted
+                            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
         
         return names
     

eric ide

mercurial