changeset 32278:8a660af9dbe3

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.
author Jun Wu <quark@fb.com>
date Tue, 09 May 2017 19:23:28 -0700
parents 1ada3d18e7fb
children c38c15d4ce48
files mercurial/context.py
diffstat 1 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- 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