diff --git a/mercurial/context.py b/mercurial/context.py --- a/mercurial/context.py +++ b/mercurial/context.py @@ -9,14 +9,7 @@ from node import nullid, nullrev, short, from i18n import _ import ancestor, bdiff, error, util, os, errno -class propertycache(object): - def __init__(self, func): - self.func = func - self.name = func.__name__ - def __get__(self, obj, type=None): - result = self.func(obj) - setattr(obj, self.name, result) - return result +propertycache = util.propertycache class changectx(object): """A changecontext object makes access to data related to a particular diff --git a/mercurial/util.py b/mercurial/util.py --- a/mercurial/util.py +++ b/mercurial/util.py @@ -137,6 +137,15 @@ def cachefunc(func): return f +class propertycache(object): + def __init__(self, func): + self.func = func + self.name = func.__name__ + def __get__(self, obj, type=None): + result = self.func(obj) + setattr(obj, self.name, result) + return result + def pipefilter(s, cmd): '''filter string S through command CMD, returning its output''' (pin, pout) = popen2(cmd, 'b')