updatecaches: adds a `caches` parameters to `repo.updatecaches`
authorPierre-Yves David <pierre-yves.david@octobus.net>
Mon, 17 May 2021 14:45:16 +0200
changeset 47297 1337bfaa88ca
parent 47296 d1589957fdcb
child 47298 e96f75857361
updatecaches: adds a `caches` parameters to `repo.updatecaches` It will superseed the `full` parameters (and its `post-clone` variant from stable). Various caller will be updated in the rest of this series. Differential Revision: https://phab.mercurial-scm.org/D10728
mercurial/localrepo.py
--- a/mercurial/localrepo.py	Mon May 17 14:41:09 2021 +0200
+++ b/mercurial/localrepo.py	Mon May 17 14:45:16 2021 +0200
@@ -2732,7 +2732,7 @@
         return updater
 
     @unfilteredmethod
-    def updatecaches(self, tr=None, full=False):
+    def updatecaches(self, tr=None, full=False, caches=None):
         """warm appropriate caches
 
         If this function is called after a transaction closed. The transaction
@@ -2754,13 +2754,14 @@
 
         unfi = self.unfiltered()
 
-        if full:
-            caches = repository.CACHES_ALL
-            if full == b"post-clone":
-                caches = caches.copy()
-                caches.discard(repository.CACHE_FILE_NODE_TAGS)
-        else:
-            caches = repository.CACHES_DEFAULT
+        if caches is None:
+            if full:
+                caches = repository.CACHES_ALL
+                if full == b"post-clone":
+                    caches = caches.copy()
+                    caches.discard(repository.CACHE_FILE_NODE_TAGS)
+            else:
+                caches = repository.CACHES_DEFAULT
 
         if repository.CACHE_BRANCHMAP_SERVED in caches:
             if tr is None or tr.changes[b'origrepolen'] < len(self):