hgext/sparse.py
changeset 33302 36a415b5a4b2
parent 33301 ca4b78eb11e7
child 33303 8b571495d811
--- a/hgext/sparse.py	Thu Jul 06 12:26:04 2017 -0700
+++ b/hgext/sparse.py	Thu Jul 06 12:20:53 2017 -0700
@@ -421,7 +421,7 @@
             """Returns the signature string representing the contents of the
             current project sparse configuration. This can be used to cache the
             sparse matcher for a given set of revs."""
-            signaturecache = self.signaturecache
+            signaturecache = self._sparsesignaturecache
             signature = signaturecache.get('signature')
             if includetemp:
                 tempsignature = signaturecache.get('tempsignature')
@@ -445,13 +445,6 @@
                     signaturecache['tempsignature'] = tempsignature
             return '%s %s' % (str(signature), str(tempsignature))
 
-        def invalidatecaches(self):
-            self.invalidatesignaturecache()
-            return super(SparseRepo, self).invalidatecaches()
-
-        def invalidatesignaturecache(self):
-            self.signaturecache.clear()
-
         def sparsematch(self, *revs, **kwargs):
             """Returns the sparse match function for the given revs.
 
@@ -470,7 +463,7 @@
 
             key = '%s %s' % (str(signature), ' '.join([str(r) for r in revs]))
 
-            result = self.sparsecache.get(key, None)
+            result = self._sparsematchercache.get(key, None)
             if result:
                 return result
 
@@ -513,7 +506,7 @@
                 tempincludes = self.gettemporaryincludes()
                 result = forceincludematcher(result, tempincludes)
 
-            self.sparsecache[key] = result
+            self._sparsematchercache[key] = result
 
             return result
 
@@ -523,7 +516,7 @@
                 '\n'.join(sorted(include)),
                 '\n'.join(sorted(exclude)))
             self.vfs.write("sparse", raw)
-            self.invalidatesignaturecache()
+            sparse.invalidatesignaturecache(self)
 
         def addtemporaryincludes(self, files):
             includes = self.gettemporaryincludes()
@@ -541,7 +534,7 @@
         def _writetemporaryincludes(self, includes):
             raw = '\n'.join(sorted(includes))
             self.vfs.write('tempsparse', raw)
-            self.invalidatesignaturecache()
+            sparse.invalidatesignaturecache(self)
 
         def prunetemporaryincludes(self):
             if repo.vfs.exists('tempsparse'):
@@ -572,15 +565,14 @@
                     dirstate.drop(file)
 
                 self.vfs.unlink('tempsparse')
-                self.invalidatesignaturecache()
+                sparse.invalidatesignaturecache(self)
                 msg = _("cleaned up %d temporarily added file(s) from the "
                         "sparse checkout\n")
                 ui.status(msg % len(tempincludes))
 
     if 'dirstate' in repo._filecache:
         repo.dirstate.repo = repo
-    repo.sparsecache = {}
-    repo.signaturecache = {}
+
     repo.__class__ = SparseRepo
 
 @command('^debugsparse', [