Mercurial > public > mercurial-scm > hg-stable
diff mercurial/localrepo.py @ 19846:9789670992d6 stable
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.
The `propertycache` test file have been augmented with test about this issue.
author | Pierre-Yves David <pierre-yves.david@ens-lyon.org> |
---|---|
date | Mon, 30 Sep 2013 14:23:14 +0200 |
parents | 14c91b18d798 |
children | 57479e0d203d |
line wrap: on
line diff
--- a/mercurial/localrepo.py Mon Sep 30 14:36:11 2013 +0200 +++ b/mercurial/localrepo.py Mon Sep 30 14:23:14 2013 +0200 @@ -39,7 +39,10 @@ """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, self.name) class filteredpropertycache(propertycache): """propertycache that must take filtering in account"""