mercurial/util.py
changeset 8207 dd8d5be57d65
parent 8181 03d93882fc93
child 8209 a1a5a57efe90
equal deleted inserted replaced
8206:cce63ef1045b 8207:dd8d5be57d65
   134             if args not in cache:
   134             if args not in cache:
   135                 cache[args] = func(*args)
   135                 cache[args] = func(*args)
   136             return cache[args]
   136             return cache[args]
   137 
   137 
   138     return f
   138     return f
       
   139 
       
   140 class propertycache(object):
       
   141     def __init__(self, func):
       
   142         self.func = func
       
   143         self.name = func.__name__
       
   144     def __get__(self, obj, type=None):
       
   145         result = self.func(obj)
       
   146         setattr(obj, self.name, result)
       
   147         return result
   139 
   148 
   140 def pipefilter(s, cmd):
   149 def pipefilter(s, cmd):
   141     '''filter string S through command CMD, returning its output'''
   150     '''filter string S through command CMD, returning its output'''
   142     (pin, pout) = popen2(cmd, 'b')
   151     (pin, pout) = popen2(cmd, 'b')
   143     def writer():
   152     def writer():