##// END OF EJS Templates
Make filectx lazier...
Matt Mackall -
r3213:e8199702 default
parent child Browse files
Show More
@@ -114,21 +114,27 b' class filectx(object):'
114
114
115 if filelog:
115 if filelog:
116 self._filelog = filelog
116 self._filelog = filelog
117 else:
118 self._filelog = self._repo.file(self._path)
119
117
120 if fileid is None:
118 if fileid is None:
121 self._changeid = changeid
119 self._changeid = changeid
122 else:
120 else:
123 self._filenode = self._filelog.lookup(fileid)
121 self._fileid = fileid
124 self._changeid = self._filelog.linkrev(self._filenode)
125
122
126 def __getattr__(self, name):
123 def __getattr__(self, name):
127 if name == '_changectx':
124 if name == '_changectx':
128 self._changectx = changectx(self._repo, self._changeid)
125 self._changectx = changectx(self._repo, self._changeid)
129 return self._changectx
126 return self._changectx
127 elif name == '_filelog':
128 self._filelog = self._repo.file(self._path)
129 return self._filelog
130 elif name == '_changeid':
131 self._changeid = self._filelog.linkrev(self._filenode)
132 return self._changeid
130 elif name == '_filenode':
133 elif name == '_filenode':
131 self._filenode = self._changectx.filenode(self._path)
134 if hasattr(self, "_fileid"):
135 self._filenode = self._filelog.lookup(self._fileid)
136 else:
137 self._filenode = self._changectx.filenode(self._path)
132 return self._filenode
138 return self._filenode
133 elif name == '_filerev':
139 elif name == '_filerev':
134 self._filerev = self._filelog.rev(self._filenode)
140 self._filerev = self._filelog.rev(self._filenode)
General Comments 0
You need to be logged in to leave comments. Login now