vfs: use propertycache for open
authorPierre-Yves David <pierre-yves.david@ens-lyon.org>
Thu, 04 Aug 2016 16:56:50 +0200
changeset 29730 2dd8c225e94c
parent 29729 37b6f0ec6241
child 29731 acf27be56d26
vfs: use propertycache for open The current open method is currently behaving like a property cache. We use our utility decorator to make this explicit.
mercurial/scmutil.py
--- a/mercurial/scmutil.py	Fri Aug 05 17:27:51 2016 -0400
+++ b/mercurial/scmutil.py	Thu Aug 04 16:56:50 2016 +0200
@@ -256,17 +256,15 @@
                 raise
         return []
 
-    def open(self, path, mode="r", text=False, atomictemp=False,
-             notindexed=False, backgroundclose=False):
+    @util.propertycache
+    def open(self):
         '''Open ``path`` file, which is relative to vfs root.
 
         Newly created directories are marked as "not to be indexed by
         the content indexing service", if ``notindexed`` is specified
         for "write" mode access.
         '''
-        self.open = self.__call__
-        return self.__call__(path, mode, text, atomictemp, notindexed,
-                             backgroundclose=backgroundclose)
+        return self.__call__
 
     def read(self, path):
         with self(path, 'rb') as fp: