Patchwork [11,of,14] vfs: drop the 'audit' parameters to '__init__'

login
register
mail settings
Submitter Pierre-Yves David
Date July 2, 2017, 2:56 a.m.
Message ID <34b8be7f0420b07d0f7b.1498964196@nodosa.octopoid.net>
Download mbox | patch
Permalink /patch/21883/
State Accepted
Headers show

Comments

Pierre-Yves David - July 2, 2017, 2:56 a.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@octobus.net>
# Date 1498959818 -7200
#      Sun Jul 02 03:43:38 2017 +0200
# Node ID 34b8be7f0420b07d0f7b71379c6055e5b26223d5
# Parent  a5ddf792663096dbc14607616232081c5eadd8e7
# EXP-Topic vfs.ward
# Available At https://www.mercurial-scm.org/repo/users/marmoute/mercurial/
#              hg pull https://www.mercurial-scm.org/repo/users/marmoute/mercurial/ -r 34b8be7f0420
vfs: drop the 'audit' parameters to '__init__'

The parameter has no users anymore so let us simplify the code. Before they got
cleared, there was few users in core and all for debug purpose, so it seems
safe to just drop it.

Patch

diff --git a/mercurial/vfs.py b/mercurial/vfs.py
--- a/mercurial/vfs.py
+++ b/mercurial/vfs.py
@@ -284,17 +284,13 @@  class vfs(abstractvfs):
     This class is used to hide the details of COW semantics and
     remote file access from higher level code.
     '''
-    def __init__(self, base, audit=True, expandpath=False, realpath=False):
+    def __init__(self, base, expandpath=False, realpath=False):
         if expandpath:
             base = util.expandpath(base)
         if realpath:
             base = os.path.realpath(base)
         self.base = base
-        self._audit = audit
-        if audit:
-            self.audit = pathutil.pathauditor(self.base)
-        else:
-            self.audit = util.always
+        self.audit = pathutil.pathauditor(self.base)
         self.createmode = None
         self._trustnlink = None
 
@@ -338,10 +334,9 @@  class vfs(abstractvfs):
         guarded by any lock (e.g. repo.lock or repo.wlock).
         '''
         if auditpath:
-            if self._audit:
-                r = util.checkosfilename(path)
-                if r:
-                    raise error.Abort("%s: %r" % (r, path))
+            r = util.checkosfilename(path)
+            if r:
+                raise error.Abort("%s: %r" % (r, path))
             self.audit(path)
         f = self.join(path)