changeset 32239:c38c15d4ce48

filectx: make renamed a property cache See previous patch for context - mainly to avoid code duplication.
author Jun Wu <quark@fb.com>
date Tue, 09 May 2017 19:48:57 -0700
parents 8a660af9dbe3
children 842ea95d45dc
files mercurial/context.py
diffstat 1 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/context.py	Tue May 09 19:23:28 2017 -0700
+++ b/mercurial/context.py	Tue May 09 19:48:57 2017 -0700
@@ -797,6 +797,8 @@
         return self._changectx.manifest()
     def changectx(self):
         return self._changectx
+    def renamed(self):
+        return self._copied
     def repo(self):
         return self._repo
 
@@ -1149,7 +1151,8 @@
     def size(self):
         return self._filelog.size(self._filerev)
 
-    def renamed(self):
+    @propertycache
+    def _copied(self):
         """check if file was actually renamed in this changeset revision
 
         If rename logged in file revision, we report copy for changeset only
@@ -2064,8 +2067,6 @@
         return self._data
     def size(self):
         return len(self.data())
-    def renamed(self):
-        return self._copied
 
     def remove(self, ignoremissing=False):
         """wraps unlink for a repo's working directory"""