# HG changeset patch
# User Simon Heimberg <[email protected]>
# Date 1242117134 -7200
# Node ID 1353b9e1e800b997286c33f77f184f86f24cd53a
# Parent  4cfc04befcdc649d6272deb3ae99554efda2fdef
nautilus: do not cache repo

caching is done in cachethg

diff -r 4cfc04befcdc -r 1353b9e1e800 contrib/nautilus-thg.py
--- a/contrib/nautilus-thg.py   Die Mai 12 21:42:32 2009 +0200
+++ b/contrib/nautilus-thg.py   Die Mai 12 10:32:14 2009 +0200
@@ -53,7 +53,6 @@
 
 
 nofilecmds = 'about serve synch repoconfig userconfig merge unmerge'.split()
-nocachecmds = 'about serve repoconfig userconfig'.split()
 
 
 class HgExtension(nautilus.MenuProvider,
@@ -62,8 +61,6 @@
                   nautilus.PropertyPageProvider):
 
     def __init__(self):
-        self.cacherepo = None
-        self.cacheroot = None
         self.scanStack = []
         self.allvfs = {}
         self.inv_dirs = set()
@@ -110,16 +107,9 @@
         '''
         p = paths.find_root(path)
 
-        if p == self.cacheroot:
-            return self.cacherepo
-        # Keep one repo cached
         try:
-            self.cacheroot = p
-            self.cacherepo = hg.repository(ui.ui(), path=p)
-            return self.cacherepo
+            return hg.repository(ui.ui(), path=p)
         except hglib.RepoError:
-            self.cacheroot = None
-            self.cacherepo = None
             return None
         except StandardError, e:
             debugf(e)
@@ -148,11 +138,6 @@
             proc.stdin.write('\n'.join(self.files))
             proc.stdin.close()
 
-        if hgtkcmd not in nocachecmds:
-            # Remove cached repo object, dirstate may change
-            self.cacherepo = None
-            self.cacheroot = None
-
     def buildMenu(self, vfs_files, bg):
         '''Build menu'''
         self.pos = 0
@@ -232,7 +217,7 @@
                                "HG Status",
                                "Version control status"),
 
-    def _get_file_status(self, repo, localpath):
+    def _get_file_status(self, localpath, repo=None):
         cachestate = cachethg.get_state(localpath, repo)
         cache2state = {cachethg.UNCHANGED: ('default', 'clean'),
                        cachethg.ADDED: ('cvs-added', 'added'),
@@ -264,9 +249,8 @@
             if oldvfs and oldvfs != vfs_file:
                 #file has changed on disc (not invalidated)
                 self.get_path_for_vfs_file(vfs_file) #save new vfs
-                root = self.cacherepo and self.cacherepo.root or ''
-                self.invalidate([os.path.dirname(path)], root)
-            emblem, status = self._get_file_status(self.cacherepo, path)
+                self.invalidate([os.path.dirname(path)])
+            emblem, status = self._get_file_status(path)
             if emblem is not None:
                 vfs_file.add_emblem(emblem)
             vfs_file.add_string_attribute('hg_status', status)
@@ -343,7 +327,7 @@
         if repo is None:
             return
         localpath = path[len(repo.root)+1:]
-        emblem, status = self._get_file_status(repo, path)
+        emblem, status = self._get_file_status(path, repo)
 
         # Get the information from Mercurial
         ctx = repo['.']

------------------------------------------------------------------------------
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image 
processing features enabled. http://p.sf.net/sfu/kodak-com
_______________________________________________
Tortoisehg-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tortoisehg-develop

Reply via email to