diff mercurial/vfs.py @ 33257:15e9cbe6ae49

vfs: simplify path audit disabling in stream clone The whole 'mustaudit' API is quite complex compared to its actual usage by its unique user in stream clone. Instead we add a "auditpath" parameter to 'vfs.__call_'. The stream clone code then explicitly open files with path auditing disabled. The 'mustaudit' API will be cleaned up in the next changeset.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Sun, 02 Jul 2017 02:28:04 +0200
parents b62d13506860
children 6fb5c5096887
line wrap: on
line diff
--- a/mercurial/vfs.py	Sun Jul 02 02:19:05 2017 +0200
+++ b/mercurial/vfs.py	Sun Jul 02 02:28:04 2017 +0200
@@ -320,7 +320,8 @@
         os.chmod(name, self.createmode & 0o666)
 
     def __call__(self, path, mode="r", text=False, atomictemp=False,
-                 notindexed=False, backgroundclose=False, checkambig=False):
+                 notindexed=False, backgroundclose=False, checkambig=False,
+                 auditpath=True):
         '''Open ``path`` file, which is relative to vfs root.
 
         Newly created directories are marked as "not to be indexed by
@@ -344,11 +345,12 @@
         only for writing), and is useful only if target file is
         guarded by any lock (e.g. repo.lock or repo.wlock).
         '''
-        if self._audit:
-            r = util.checkosfilename(path)
-            if r:
-                raise error.Abort("%s: %r" % (r, path))
-        self.audit(path)
+        if auditpath:
+            if self._audit:
+                r = util.checkosfilename(path)
+                if r:
+                    raise error.Abort("%s: %r" % (r, path))
+            self.audit(path)
         f = self.join(path)
 
         if not text and "b" not in mode: