comparison 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
comparison
equal deleted inserted replaced
8206:cce63ef1045b 8207:dd8d5be57d65
7 7
8 from node import nullid, nullrev, short, hex 8 from node import nullid, nullrev, short, hex
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
23 changeset convenient.""" 16 changeset convenient."""
24 def __init__(self, repo, changeid=''): 17 def __init__(self, repo, changeid=''):