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.
--- a/mercurial/localrepo.py Tue Jan 15 23:33:07 2013 +0100
+++ b/mercurial/localrepo.py Wed Jan 16 00:12:01 2013 +0100
@@ -2477,8 +2477,14 @@
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: