filectx: make flags a property cache
authorJun Wu <quark@fb.com>
Tue, 09 May 2017 19:23:28 -0700
changeset 32238 8a660af9dbe3
parent 32237 1ada3d18e7fb
child 32239 c38c15d4ce48
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.
mercurial/context.py
--- 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