filectx: make flags a property cache
Make basefilectx._flags a property cache, so basefilectx.flags() could be
reasonably reused. This avoids code duplication between memfilectx and a
class added in a later patch.
--- a/mercurial/context.py Sun Apr 30 11:21:05 2017 -0700
+++ b/mercurial/context.py Tue May 09 19:23:28 2017 -0700
@@ -762,8 +762,11 @@
return self._filerev
def filenode(self):
return self._filenode
+ @propertycache
+ def _flags(self):
+ return self._changectx.flags(self._path)
def flags(self):
- return self._changectx.flags(self._path)
+ return self._flags
def filelog(self):
return self._filelog
def rev(self):
@@ -2061,8 +2064,6 @@
return self._data
def size(self):
return len(self.data())
- def flags(self):
- return self._flags
def renamed(self):
return self._copied