mercurial/vfs.py
branchstable
changeset 33633 20bac46f7744
parent 31644 f80d9ddc40f3
--- a/mercurial/vfs.py	Tue Aug 01 21:03:25 2017 +0900
+++ b/mercurial/vfs.py	Wed Jul 26 22:10:15 2017 +0900
@@ -276,13 +276,19 @@
 
     This class is used to hide the details of COW semantics and
     remote file access from higher level code.
+
+    'cacheaudited' should be enabled only if (a) vfs object is short-lived, or
+    (b) the base directory is managed by hg and considered sort-of append-only.
+    See pathutil.pathauditor() for details.
     '''
-    def __init__(self, base, audit=True, expandpath=False, realpath=False):
+    def __init__(self, base, audit=True, cacheaudited=False, expandpath=False,
+                 realpath=False):
         if expandpath:
             base = util.expandpath(base)
         if realpath:
             base = os.path.realpath(base)
         self.base = base
+        self._cacheaudited = cacheaudited
         self.mustaudit = audit
         self.createmode = None
         self._trustnlink = None
@@ -295,7 +301,8 @@
     def mustaudit(self, onoff):
         self._audit = onoff
         if onoff:
-            self.audit = pathutil.pathauditor(self.base)
+            self.audit = pathutil.pathauditor(
+                self.base, cached=self._cacheaudited)
         else:
             self.audit = util.always