Patchwork [2,of,2,STABLE] repoview: have unfilteredpropertycache using the underlying cache

mail settings
Submitter Pierre-Yves David
Date Sept. 10, 2013, 11:43 a.m.
Message ID <9eb9c5a068b4d935105c.1378813389@yamac-wifi.lan>
Download mbox | patch
Permalink /patch/2417/
State Superseded
Commit 9789670992d6980548fe6dfb6a6113095901b110
Headers show


Pierre-Yves David - Sept. 10, 2013, 11:43 a.m.
# HG changeset patch
# User Pierre-Yves David <>
# Date 1378805505 -7200
#      Tue Sep 10 11:31:45 2013 +0200
# Branch stable
# Node ID 9eb9c5a068b4d935105c87b083143f8bd53b002f
# Parent  accf46f194e4f5aee5d48c5c910ad169dd419458
repoview: have unfilteredpropertycache using the underlying cache

A  `unfilteredpropertycache` is a kind of `propertycache` used on `localrepo` to
unsure it will always be run against unfiltered repo and stored only once.

As the cached value is never stored in the repoview instance, the descriptor
will always be called. Before this patch such calls always result in a call to
the `__get__` method of the `propertycache` on the unfiltered repo. That was
recomputing a new value on every access through a repoview.

We can't prevent the repoview's `unfilteredpropertycache` to get called on every
access. In that case the new code makes a standard attribute access to the
property. If a value is cached it will be used.


diff --git a/mercurial/ b/mercurial/
--- a/mercurial/
+++ b/mercurial/
@@ -37,11 +37,14 @@  class storecache(repofilecache):
 class unfilteredpropertycache(propertycache):
     """propertycache that apply to unfiltered repo only"""
     def __get__(self, repo, type=None):
-        return super(unfilteredpropertycache, self).__get__(repo.unfiltered())
+        unfi = repo.unfiltered()
+        if unfi is repo:
+            return super(unfilteredpropertycache, self).__get__(unfi)
+        return getattr(unfi,
 class filteredpropertycache(propertycache):
     """propertycache that must take filtering in account"""
     def cachevalue(self, obj, value):