changeset 8157:77c5877a668c

context: use Python 2.4 decorator syntax
author Martin Geisler <mg@lazybytes.net>
date Fri, 24 Apr 2009 18:47:15 +0200
parents 9fd0822c2ec3
children 1bef3656d9fe
files mercurial/context.py
diffstat 1 files changed, 18 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/context.py	Fri Apr 24 17:32:18 2009 +0200
+++ b/mercurial/context.py	Fri Apr 24 18:47:15 2009 +0200
@@ -60,24 +60,24 @@
     def __nonzero__(self):
         return self._rev != nullrev
 
+    @propertycache
     def _changeset(self):
         return self._repo.changelog.read(self.node())
-    _changeset = propertycache(_changeset)
 
+    @propertycache
     def _manifest(self):
         return self._repo.manifest.read(self._changeset[0])
-    _manifest = propertycache(_manifest)
 
+    @propertycache
     def _manifestdelta(self):
         return self._repo.manifest.readdelta(self._changeset[0])
-    _manifestdelta = propertycache(_manifestdelta)
 
+    @propertycache
     def _parents(self):
         p = self._repo.changelog.parentrevs(self._rev)
         if p[1] == nullrev:
             p = p[:-1]
         return [changectx(self._repo, x) for x in p]
-    _parents = propertycache(_parents)
 
     def __contains__(self, key):
         return key in self._manifest
@@ -201,35 +201,35 @@
         if fileid is not None:
             self._fileid = fileid
 
+    @propertycache
     def _changectx(self):
         return changectx(self._repo, self._changeid)
-    _changectx = propertycache(_changectx)
 
+    @propertycache
     def _filelog(self):
         return self._repo.file(self._path)
-    _filelog = propertycache(_filelog)
 
+    @propertycache
     def _changeid(self):
         if '_changectx' in self.__dict__:
             return self._changectx.rev()
         else:
             return self._filelog.linkrev(self._filerev)
-    _changeid = propertycache(_changeid)
 
+    @propertycache
     def _filenode(self):
         if '_fileid' in self.__dict__:
             return self._filelog.lookup(self._fileid)
         else:
             return self._changectx.filenode(self._path)
-    _filenode = propertycache(_filenode)
 
+    @propertycache
     def _filerev(self):
         return self._filelog.rev(self._filenode)
-    _filerev = propertycache(_filerev)
 
+    @propertycache
     def _repopath(self):
         return self._path
-    _repopath = propertycache(_repopath)
 
     def __nonzero__(self):
         try:
@@ -515,6 +515,7 @@
     def __contains__(self, key):
         return self._repo.dirstate[key] not in "?r"
 
+    @propertycache
     def _manifest(self):
         """generate a manifest corresponding to the working directory"""
 
@@ -536,27 +537,26 @@
                 del man[f]
 
         return man
-    _manifest = propertycache(_manifest)
 
+    @propertycache
     def _status(self):
         return self._repo.status(unknown=True)
-    _status = propertycache(_status)
 
+    @propertycache
     def _user(self):
         return self._repo.ui.username()
-    _user = propertycache(_user)
 
+    @propertycache
     def _date(self):
         return util.makedate()
-    _date = propertycache(_date)
 
+    @propertycache
     def _parents(self):
         p = self._repo.dirstate.parents()
         if p[1] == nullid:
             p = p[:-1]
         self._parents = [changectx(self._repo, x) for x in p]
         return self._parents
-    _parents = propertycache(_parents)
 
     def manifest(self): return self._manifest
 
@@ -631,17 +631,17 @@
         if workingctx:
             self._changectx = workingctx
 
+    @propertycache
     def _changectx(self):
         return workingctx(self._repo)
-    _changectx = propertycache(_changectx)
 
+    @propertycache
     def _repopath(self):
         return self._repo.dirstate.copied(self._path) or self._path
-    _repopath = propertycache(_repopath)
 
+    @propertycache
     def _filelog(self):
         return self._repo.file(self._repopath)
-    _filelog = propertycache(_filelog)
 
     def __nonzero__(self):
         return True