Comments
Patch
@@ -277,11 +277,11 @@ class propertycache(object):
result = self.func(obj)
self.cachevalue(obj, result)
return result
def cachevalue(self, obj, value):
- setattr(obj, self.name, value)
+ obj.__dict__[self.name] = value
def pipefilter(s, cmd):
'''filter string S through command CMD, returning its output'''
p = subprocess.Popen(cmd, shell=True, close_fds=closefds,
stdin=subprocess.PIPE, stdout=subprocess.PIPE)
However the repo.mq in a special `unfilteredpropertycache` were a second layer of bug happen. The access to `unfilteredpropertycache` are always forwarded to the unfiltered repo. But it's done wrongly. The `unfilteredpropertycache` explicitly call propertycache.__get__ on each access and therefore never use the cached value. It should just access the attribute on the unfiltered repo and leave the underlying propertycache do the work. The patch below does that.
@@ -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, self.name)
class filteredpropertycache(propertycache):
"""propertycache that must take filtering in account"""
def cachevalue(self, obj, value):