revlog: make clearcaches() more effective
authorGregory Szorc <gregory.szorc@gmail.com>
Sun, 20 Dec 2015 17:48:20 -0800
changeset 27465 072a675c51f2
parent 27464 c39ecb2b86b3
child 27466 f888676a23d0
revlog: make clearcaches() more effective clearcaches() was added several years ago in e8d37b78acfb as part of implementing a perf command. Since revlog instances have many caches and since the spirit of this mostly unused method is to facilitate performance testing, I think it's appropriate for all the revlog's caches to get cleared when it is called.
mercurial/revlog.py
--- a/mercurial/revlog.py	Mon Dec 21 22:31:16 2015 +0900
+++ b/mercurial/revlog.py	Sun Dec 20 17:48:20 2015 -0800
@@ -339,6 +339,11 @@
             return False
 
     def clearcaches(self):
+        self._cache = None
+        self._basecache = None
+        self._chunkcache = (0, '')
+        self._pcache = {}
+
         try:
             self._nodecache.clearcaches()
         except AttributeError: