Mercurial > public > mercurial-scm > hg-stable
diff mercurial/repoview.py @ 18101:a464deecc9dd
clfilter: add a cache on repo for set of revision to filter for a given set.
Recomputing the filtered revisions at every access to changelog is far too
expensive. This changeset introduce a cache for this information. This cache is
hold by the repository (unfiltered repository) and invalidated when necessary.
This cache is not a protected attribute (leading _) because some logic that
invalidate it is not held by the local repo itself.
author | Pierre-Yves David <pierre-yves.david@ens-lyon.org> |
---|---|
date | Thu, 20 Dec 2012 17:14:07 +0100 |
parents | 3a6ddacb7198 |
children | 3c7b67b76190 |
line wrap: on
line diff
--- a/mercurial/repoview.py Thu Dec 20 15:32:42 2012 +0100 +++ b/mercurial/repoview.py Thu Dec 20 17:14:07 2012 +0100 @@ -13,7 +13,10 @@ def filteredrevs(repo, filtername): """returns set of filtered revision for this filter name""" - return filtertable[filtername](repo.unfiltered()) + if filtername not in repo.filteredrevcache: + func = filtertable[filtername] + repo.filteredrevcache[filtername] = func(repo.unfiltered()) + return repo.filteredrevcache[filtername] class repoview(object): """Provide a read/write view of a repo through a filtered changelog