Patchwork D10728: updatecaches: adds a `caches` parameters to `repo.updatecaches`

login
register
mail settings
Submitter phabricator
Date May 18, 2021, 7:48 a.m.
Message ID <differential-rev-PHID-DREV-vln2f25rqdfic5uaii2t-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/49047/
State Superseded
Headers show

Comments

phabricator - May 18, 2021, 7:48 a.m.
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  It will superseed the `full` parameters (and its `post-clone` variant from
  stable). Various caller will be updated in the rest of this series.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D10728

AFFECTED FILES
  mercurial/localrepo.py

CHANGE DETAILS




To: marmoute, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -2718,7 +2718,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
@@ -2740,13 +2740,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):