mercurial/util.py
changeset 18013 98c867ac1330
parent 17962 4c29668ca316
child 18026 ddc0323db78b
equal deleted inserted replaced
18012:848c428bb5ee 18013:98c867ac1330
   242     def __init__(self, func):
   242     def __init__(self, func):
   243         self.func = func
   243         self.func = func
   244         self.name = func.__name__
   244         self.name = func.__name__
   245     def __get__(self, obj, type=None):
   245     def __get__(self, obj, type=None):
   246         result = self.func(obj)
   246         result = self.func(obj)
   247         setattr(obj, self.name, result)
   247         self.cachevalue(obj, result)
   248         return result
   248         return result
       
   249 
       
   250     def cachevalue(self, obj, value):
       
   251         setattr(obj, self.name, value)
   249 
   252 
   250 def pipefilter(s, cmd):
   253 def pipefilter(s, cmd):
   251     '''filter string S through command CMD, returning its output'''
   254     '''filter string S through command CMD, returning its output'''
   252     p = subprocess.Popen(cmd, shell=True, close_fds=closefds,
   255     p = subprocess.Popen(cmd, shell=True, close_fds=closefds,
   253                          stdin=subprocess.PIPE, stdout=subprocess.PIPE)
   256                          stdin=subprocess.PIPE, stdout=subprocess.PIPE)