[PATCH] localrepo: clear the filecache on _rollback() and destroyed()

Idan Kamara idankk86 at gmail.com
Sat Jul 28 14:40:37 CDT 2012


# HG changeset patch
# User Idan Kamara <idankk86 at gmail.com>
# Date 1343504430 -10800
# Branch stable
# Node ID b4aefebff45caa66ca253c43a673b5847a2b84a6
# Parent  a09cc6aeed4a6d54a3846b6653165fd3b328d1ef
localrepo: clear the filecache on _rollback() and destroyed()

This restores the old behaviour of clearing the filecache when the repo is
destroyed but combines it with also clearing it on _rollback. Before, we tried
to only call it through _rollback but that ruined callers of destroyed.

Doing it on both code paths covers destroyed being called from somewhere
else, e.g. strip.

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -996,6 +996,9 @@
                         self.sjoin('phaseroots'))
         self.invalidate()
 
+        # Discard all cache entries to force reloading everything.
+        self._filecache.clear()
+
         parentgone = (parents[0] not in self.changelog.nodemap or
                       parents[1] not in self.changelog.nodemap)
         if parentgone:
@@ -1063,9 +1066,6 @@
                 pass
         self.invalidatecaches()
 
-        # Discard all cache entries to force reloading everything.
-        self._filecache.clear()
-
     def _lock(self, lockname, wait, releasefn, acquirefn, desc):
         try:
             l = lock.lock(lockname, 0, releasefn, desc=desc)
@@ -1499,6 +1499,9 @@
         # tag cache retrieval" case to work.
         self.invalidatecaches()
 
+        # Discard all cache entries to force reloading everything.
+        self._filecache.clear()
+
     def walk(self, match, node=None):
         '''
         walk recursively through the directory tree or a given


More information about the Mercurial-devel mailing list