[PATCH 1 of 7] vfs: use propertycache for open

Pierre-Yves David pierre-yves.david at ens-lyon.org
Fri Aug 5 13:59:14 UTC 2016


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at ens-lyon.org>
# Date 1470322610 -7200
#      Thu Aug 04 16:56:50 2016 +0200
# Node ID 9b65c0820c940442454e5f92a9475c4ec97f705c
# Parent  73ff159923c1f05899c27238409ca398342d9ae0
# EXP-Topic vfsward
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.

diff -r 73ff159923c1 -r 9b65c0820c94 mercurial/scmutil.py
--- a/mercurial/scmutil.py	Mon Aug 01 13:14:13 2016 -0400
+++ b/mercurial/scmutil.py	Thu Aug 04 16:56:50 2016 +0200
@@ -256,17 +256,15 @@ class abstractvfs(object):
                 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:


More information about the Mercurial-devel mailing list