changeset 51136:6a78b5a1d1ab stable

perf-tags: fix clear_cache_fnodes to actually clear that cache The function was not doing it what it advertise for a long time. So we fix it and we add a way for the perf extensions to detect broken version.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Sun, 03 Dec 2023 04:49:49 +0100
parents 2705748ba166
children 22d11305f365
files contrib/perf.py mercurial/tags.py
diffstat 2 files changed, 9 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/perf.py	Sun Dec 03 04:43:08 2023 +0100
+++ b/contrib/perf.py	Sun Dec 03 04:49:49 2023 +0100
@@ -973,11 +973,10 @@
         "clear_cache_on_disk",
         _default_clear_on_disk_tags_cache,
     )
-    clear_fnodes_fn = getattr(
-        tags,
-        "clear_cache_fnodes",
-        _default_clear_on_disk_tags_fnodes_cache,
-    )
+    if getattr(tags, 'clear_cache_fnodes_is_working', False):
+        clear_fnodes_fn = tags.clear_cache_fnodes
+    else:
+        clear_fnodes_fn = _default_clear_on_disk_tags_fnodes_cache
     clear_fnodes_rev_fn = getattr(
         tags,
         "forget_fnodes",
--- a/mercurial/tags.py	Sun Dec 03 04:43:08 2023 +0100
+++ b/mercurial/tags.py	Sun Dec 03 04:49:49 2023 +0100
@@ -916,9 +916,13 @@
     repo.cachevfs.tryunlink(_filename(repo))
 
 
+# a small attribute to help `hg perf::tags` to detect a fixed version.
+clear_cache_fnodes_is_working = True
+
+
 def clear_cache_fnodes(repo):
     """function used by the perf extension to clear "file node cache"""
-    repo.cachevfs.tryunlink(_filename(repo))
+    repo.cachevfs.tryunlink(_fnodescachefile)
 
 
 def forget_fnodes(repo, revs):