[PATCH] localrepo: get value from the unfiltered caches should check if the attribute existed

Matt Mackall mpm at selenic.com
Wed Aug 14 13:30:52 CDT 2013


On Tue, 2013-08-06 at 11:45 +0800, elson.wei at gmail.com wrote:
> # HG changeset patch
> # User Wei, Elson <elson.wei at gmail.com>
> # Date 1375760701 -28800
> #      Tue Aug 06 11:45:01 2013 +0800
> # Node ID 06e23972c0d2d9420e96dd657db1cc2d30b7fc11
> # Parent  a58251c0568fc5e86089a803ca75f75cc8c01678
> localrepo: get value from the unfiltered caches should check if the attribute existed.
> 
> If the attribute existed already, it should be returned by getattr().
> Otherwise, it will be evaluated again.

So.. this sounds important. Can you explain how/where this causes a
problem?

> diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
> --- a/mercurial/localrepo.py
> +++ b/mercurial/localrepo.py
> @@ -39,6 +39,8 @@
>      """propertycache that apply to unfiltered repo only"""
>  
>      def __get__(self, repo, type=None):
> +        if hasunfilteredcache(repo, self.name):
> +            return getattr(repo.unfiltered(), self.name)
>          return super(unfilteredpropertycache, self).__get__(repo.unfiltered())
>  
>  class filteredpropertycache(propertycache):
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel


-- 
Mathematics is the supreme nostalgia of our time.




More information about the Mercurial-devel mailing list