Patchwork [1,of,3,V2] vfs: makes all audited path relative

login
register
mail settings
Submitter Boris Feld
Date Dec. 31, 2018, 5:37 p.m.
Message ID <5479d748f59531f66692.1546277848@Laptop-Boris.lan>
Download mbox | patch
Permalink /patch/37414/
State Accepted
Headers show

Comments

Boris Feld - Dec. 31, 2018, 5:37 p.m.
# HG changeset patch
# User Boris Feld <boris.feld@octobus.net>
# Date 1498963863 -7200
#      Sun Jul 02 04:51:03 2017 +0200
# Node ID 5479d748f59531f6669290e092a12920cbcc8349
# Parent  9bfbb9fc58711308708003846f8beb63ac21b9d0
# EXP-Topic vfs.audit-rename
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 5479d748f595
vfs: makes all audited path relative

Only auditing relative path helps the vfs warning logic.

Patch

diff --git a/mercurial/vfs.py b/mercurial/vfs.py
--- a/mercurial/vfs.py
+++ b/mercurial/vfs.py
@@ -339,6 +339,8 @@  class vfs(abstractvfs):
 
     def _auditpath(self, path, mode):
         if self._audit:
+            if os.path.isabs(path) and path.startswith(self.base):
+                path = os.path.relpath(path, self.base)
             r = util.checkosfilename(path)
             if r:
                 raise error.Abort("%s: %r" % (r, path))