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

elson.wei at gmail.com elson.wei at gmail.com
Fri Aug 9 08:50:05 CDT 2013


# HG changeset patch
# User Wei, Elson <elson.wei at gmail.com>
# Date 1375840785 -28800
#      Wed Aug 07 09:59:45 2013 +0800
# Node ID 7a67f75deafc8880b539d3da42a719dab00d7cd6
# Parent  df2155ebf502d14f7ef5276df806a35fc06dabd5
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.

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):


More information about the Mercurial-devel mailing list