Mercurial > public > mercurial-scm > hg
comparison mercurial/revlog.py @ 27465:072a675c51f2
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.
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Sun, 20 Dec 2015 17:48:20 -0800 |
parents | 77c51a56392e |
children | 93ac15f03331 |
comparison
equal
deleted
inserted
replaced
27464:c39ecb2b86b3 | 27465:072a675c51f2 |
---|---|
337 return True | 337 return True |
338 except KeyError: | 338 except KeyError: |
339 return False | 339 return False |
340 | 340 |
341 def clearcaches(self): | 341 def clearcaches(self): |
342 self._cache = None | |
343 self._basecache = None | |
344 self._chunkcache = (0, '') | |
345 self._pcache = {} | |
346 | |
342 try: | 347 try: |
343 self._nodecache.clearcaches() | 348 self._nodecache.clearcaches() |
344 except AttributeError: | 349 except AttributeError: |
345 self._nodecache = {nullid: nullrev} | 350 self._nodecache = {nullid: nullrev} |
346 self._nodepos = None | 351 self._nodepos = None |