filectx: lazy linkrev usage
authorMatt Mackall <mpm@selenic.com>
Fri, 22 Sep 2006 16:01:14 -0500
changeset 3150 a5e4c8172ace
parent 3149 ff1ab08e6732
child 3151 6719b3dd7d50
filectx: lazy linkrev usage
mercurial/context.py
--- a/mercurial/context.py	Fri Sep 22 15:34:02 2006 -0500
+++ b/mercurial/context.py	Fri Sep 22 16:01:14 2006 -0500
@@ -124,7 +124,11 @@
     def filenode(self): return self._filenode
     def filelog(self): return self._filelog
 
-    def rev(self): return self._changectx.rev()
+    def rev(self):
+        if hasattr(self, "_changectx"):
+            return self._changectx.rev()
+        return self._filelog.linkrev(self._filenode)
+
     def node(self): return self._changectx.node()
     def user(self): return self._changectx.user()
     def date(self): return self._changectx.date()