# HG changeset patch
# User Boris Feld <boris.f...@octobus.net>
# Date 1542951148 -3600
#      Fri Nov 23 06:32:28 2018 +0100
# Node ID ba101026c80452a9f60b3d574011c7e8773b5a4e
# Parent  56efcdd74aee7b45d2b85a7d414033cae6b465c7
# EXP-Topic perf-branchmap
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
ba101026c804
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.

diff --git a/contrib/perf.py b/contrib/perf.py
--- a/contrib/perf.py
+++ b/contrib/perf.py
@@ -465,6 +465,12 @@ def clearfilecache(obj, attrname):
         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)
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to