changeset 51621:6378d57562af

tags-cache: add a dedicated warm cache function to hgtagsfnodescache Having a dedicated API point will help to optimize that specific usage. Right doing a full phases weam takes a long time, even when the cache is already filled.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Wed, 13 Mar 2024 11:34:21 +0100
parents 3a6fae3bef35
children b4a6a1ff8fce
files mercurial/localrepo.py mercurial/tags.py
diffstat 2 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/localrepo.py	Tue Apr 09 22:37:15 2024 +0200
+++ b/mercurial/localrepo.py	Wed Mar 13 11:34:21 2024 +0100
@@ -2959,7 +2959,7 @@
 
         if repository.CACHE_FILE_NODE_TAGS in caches:
             # accessing fnode cache warms the cache
-            tagsmod.fnoderevs(self.ui, unfi, unfi.changelog.revs())
+            tagsmod.warm_cache(self)
 
         if repository.CACHE_TAGS_DEFAULT in caches:
             # accessing tags warm the cache
--- a/mercurial/tags.py	Tue Apr 09 22:37:15 2024 +0200
+++ b/mercurial/tags.py	Wed Mar 13 11:34:21 2024 +0100
@@ -80,6 +80,12 @@
 # setting it) for each tag is last.
 
 
+def warm_cache(repo):
+    """ensure the cache is properly filled"""
+    unfi = repo.unfiltered()
+    fnoderevs(repo.ui, unfi, unfi.changelog.revs())
+
+
 def fnoderevs(ui, repo, revs):
     """return the list of '.hgtags' fnodes used in a set revisions