##// END OF EJS Templates
util: take propertycache from context.py
Matt Mackall -
r8207:dd8d5be5 default
parent child Browse files
Show More
@@ -9,14 +9,7 b' from node import nullid, nullrev, short,'
9 from i18n import _
9 from i18n import _
10 import ancestor, bdiff, error, util, os, errno
10 import ancestor, bdiff, error, util, os, errno
11
11
12 class propertycache(object):
12 propertycache = util.propertycache
13 def __init__(self, func):
14 self.func = func
15 self.name = func.__name__
16 def __get__(self, obj, type=None):
17 result = self.func(obj)
18 setattr(obj, self.name, result)
19 return result
20
13
21 class changectx(object):
14 class changectx(object):
22 """A changecontext object makes access to data related to a particular
15 """A changecontext object makes access to data related to a particular
@@ -137,6 +137,15 b' def cachefunc(func):'
137
137
138 return f
138 return f
139
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
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')
General Comments 0
You need to be logged in to leave comments. Login now