perf: introduce a function to fully "unload" a changelog
authorBoris Feld <boris.feld@octobus.net>
Fri, 23 Nov 2018 06:32:28 +0100
changeset 40701 e4ea63855d5a
parent 40700 30f443d34a7d
child 40702 4240a1da4188
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.
contrib/perf.py
--- 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)