From patchwork Tue May 18 07:49:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: D10730: updatecaches: use the `caches` argument instead of a special `full` value From: phabricator X-Patchwork-Id: 49050 Message-Id: To: Phabricator Cc: mercurial-devel@mercurial-scm.org Date: Tue, 18 May 2021 07:49:11 +0000 marmoute created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY After a clone we want to update most cachem, but not exactly all of them. We can now cleanly express this. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D10730 AFFECTED FILES mercurial/hg.py mercurial/interfaces/repository.py mercurial/localrepo.py CHANGE DETAILS To: marmoute, #hg-reviewers Cc: mercurial-patches, mercurial-devel diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -2744,8 +2744,7 @@ if full: caches = repository.CACHES_ALL if full == b"post-clone": - caches = caches.copy() - caches.discard(repository.CACHE_FILE_NODE_TAGS) + caches = repository.CACHES_POST_CLONE else: caches = repository.CACHES_DEFAULT diff --git a/mercurial/interfaces/repository.py b/mercurial/interfaces/repository.py --- a/mercurial/interfaces/repository.py +++ b/mercurial/interfaces/repository.py @@ -87,6 +87,11 @@ CACHE_TAGS_SERVED, } +# the cache to warm by default on simple call +# (this is a mutable set to let extension update it) +CACHES_POST_CLONE = CACHES_ALL.copy() +CACHES_POST_CLONE.discard(CACHE_FILE_NODE_TAGS) + class ipeerconnection(interfaceutil.Interface): """Represents a "connection" to a repository. diff --git a/mercurial/hg.py b/mercurial/hg.py --- a/mercurial/hg.py +++ b/mercurial/hg.py @@ -52,6 +52,7 @@ verify as verifymod, vfs as vfsmod, ) +from .interfaces import repository as repositorymod from .utils import ( hashutil, stringutil, @@ -1054,7 +1055,7 @@ # as the only "bad" outcome would be some slowness. That potential # slowness already affect reader. with destrepo.lock(): - destrepo.updatecaches(full=b"post-clone") + destrepo.updatecaches(caches=repositorymod.CACHES_POST_CLONE) finally: release(srclock, destlock) if cleandir is not None: