diff mercurial/context.py @ 8207:dd8d5be57d65

util: take propertycache from context.py
author Matt Mackall <mpm@selenic.com>
date Sun, 26 Apr 2009 16:50:44 -0500
parents 77c5877a668c
children a1a5a57efe90
line wrap: on
line diff
--- a/mercurial/context.py	Sun Apr 26 16:50:44 2009 -0500
+++ b/mercurial/context.py	Sun Apr 26 16:50:44 2009 -0500
@@ -9,14 +9,7 @@
 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