changeset 40701:e4ea63855d5a

perf: introduce a function to fully "unload" a changelog The function remove various attributes and caches related to changelog. This is getting a common requirement.
author Boris Feld <boris.feld@octobus.net>
date Fri, 23 Nov 2018 06:32:28 +0100
parents 30f443d34a7d
children 4240a1da4188
files contrib/perf.py
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/perf.py	Fri Nov 23 01:32:57 2018 +0100
+++ b/contrib/perf.py	Fri Nov 23 06:32:28 2018 +0100
@@ -465,6 +465,12 @@
         delattr(obj, attrname)
     obj._filecache.pop(attrname, None)
 
+def clearchangelog(repo):
+    if repo is not repo.unfiltered():
+        object.__setattr__(repo, r'_clcachekey', None)
+        object.__setattr__(repo, r'_clcache', None)
+    clearfilecache(repo.unfiltered(), 'changelog')
+
 # perf commands
 
 @command(b'perfwalk', formatteropts)