From patchwork Tue Jan 15 23:20:31 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [4, of, 4] stream_in: write the remote branchcache for a usage as wide as possible From: Pierre-Yves David X-Patchwork-Id: 635 Message-Id: To: mercurial-devel@selenic.com Date: Wed, 16 Jan 2013 00:20:31 +0100 # HG changeset patch # User Pierre-Yves David # Date 1358291521 -3600 # Node ID ec59887cc09181f36aa0ebc0b3c9410b855aea29 # Parent 5175c9be5963aebd2a774015fd02050e924dbf63 stream_in: write the remote branchcache for a usage as wide as possible Writing cache for unfiltered repo only is barely useful, Most repo user are now at least use the `hidden` filter. This changeset now assigns the remote cache for a filter as low as possible for a wider reuse as possible. diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -2475,12 +2475,18 @@ class localrepository(object): rtiprev = max((int(self.changelog.rev(node)) for node in rbheads)) cache = branchmap.branchcache(rbranchmap, self[rtiprev].node(), rtiprev) - self._branchcaches[None] = cache - cache.write(self.unfiltered()) + # Try to stick it as low as possible + # filter above served are unlikely to be fetch from a clone + for candidate in ('base', 'immutable', 'served'): + rview = self.filtered(candidate) + if cache.validfor(rview): + self._branchcaches[candidate] = cache + cache.write(rview) + break self.invalidate() return len(self.heads()) + 1 finally: lock.release()