[PATCH 3 of 9] vfs: add "open()" for newly added code paths which open files via vfs

FUJIWARA Katsunori foozy at lares.dti.ne.jp
Mon Oct 14 11:16:03 CDT 2013


# HG changeset patch
# User FUJIWARA Katsunori <foozy at lares.dti.ne.jp>
# Date 1381765864 -32400
#      Tue Oct 15 00:51:04 2013 +0900
# Node ID 2e396a54482df124d5d4cb58be2398a143edefe7
# Parent  661c03d3bd9642203a8543b534237fa474e5bc06
vfs: add "open()" for newly added code paths which open files via vfs

This patch replaces "open()" by own "__call__()" defined in derived
classes at the first invocation, for efficiency of succeeding
invocations.

diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -217,6 +217,10 @@
                 raise
         return ""
 
+    def open(self, path, mode="r", text=False, atomictemp=False):
+        self.open = self.__call__
+        return self.__call__(path, mode, text, atomictemp)
+
     def read(self, path):
         fp = self(path, 'rb')
         try:


More information about the Mercurial-devel mailing list