diff mercurial/localrepo.py @ 47183:8be95673eb8a stable

cache: avoid warming the fnodetags cache after clone That cache can quite expensive to compute on large repository as not that `hg clone` is warming all cache, this can introduces a significant slowdown for clone time[1]. As a stop gap measure introduce a quick fix for that on stable, skipping the fnodetags cache post-clone. [1] https://www.mercurial-scm.org/pipermail/mercurial/2021-April/052679.html Differential Revision: https://phab.mercurial-scm.org/D10695
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Fri, 07 May 2021 10:39:58 +0200
parents ffd3e823a7e5
children bcafcd779d2e
line wrap: on
line diff
--- a/mercurial/localrepo.py	Wed May 05 17:47:30 2021 -0400
+++ b/mercurial/localrepo.py	Fri May 07 10:39:58 2021 +0200
@@ -2727,6 +2727,11 @@
 
         If 'full' is set, make sure all caches the function knows about have
         up-to-date data. Even the ones usually loaded more lazily.
+
+        The `full` argument can take a special "post-clone" value. In this case
+        the cache warming is made after a clone and of the slower cache might
+        be skipped, namely the `.fnodetags` one. This argument is 5.8 specific
+        as we plan for a cleaner way to deal with this for 5.9.
         """
         if tr is not None and tr.hookargs.get(b'source') == b'strip':
             # During strip, many caches are invalid but
@@ -2754,8 +2759,9 @@
             for ctx in self[b'.'].parents():
                 ctx.manifest()  # accessing the manifest is enough
 
-            # accessing fnode cache warms the cache
-            tagsmod.fnoderevs(self.ui, unfi, unfi.changelog.revs())
+            if not full == b"post-clone":
+                # accessing fnode cache warms the cache
+                tagsmod.fnoderevs(self.ui, unfi, unfi.changelog.revs())
             # accessing tags warm the cache
             self.tags()
             self.filtered(b'served').tags()