changeset 27232:79a86a95f325

pathauditor: add a way to skip file system check We need to be able to skip it when looking at data within the history. Doing them in all cases leads to buggy behavior like issue4749.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Thu, 03 Dec 2015 10:40:19 -0800
parents 6d29ce250a3d
children dfb836a31b61
files mercurial/pathutil.py
diffstat 1 files changed, 10 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/pathutil.py	Thu Dec 03 12:22:48 2015 -0800
+++ b/mercurial/pathutil.py	Thu Dec 03 10:40:19 2015 -0800
@@ -23,15 +23,22 @@
     - under top-level .hg
     - starts at the root of a windows drive
     - contains ".."
+
+    More check are also done about the file system states:
     - traverses a symlink (e.g. a/symlink_here/b)
     - inside a nested repository (a callback can be used to approve
       some nested repositories, e.g., subrepositories)
+
+    The file system checks are only done when 'realfs' is set to True (the
+    default). They should be disable then we are auditing path for operation on
+    stored history.
     '''
 
-    def __init__(self, root, callback=None):
+    def __init__(self, root, callback=None, realfs=True):
         self.audited = set()
         self.auditeddir = set()
         self.root = root
+        self._realfs = realfs
         self.callback = callback
         if os.path.lexists(root) and not util.checkcase(root):
             self.normcase = util.normcase
@@ -81,7 +88,8 @@
             normprefix = os.sep.join(normparts)
             if normprefix in self.auditeddir:
                 break
-            self._checkfs(prefix, path)
+            if self._realfs:
+                self._checkfs(prefix, path)
             prefixes.append(normprefix)
             parts.pop()
             normparts.pop()