Patchwork [5,of,6] vfs: makes all audited path relative

login
register
mail settings
Submitter Boris Feld
Date Nov. 26, 2018, 6:22 p.m.
Message ID <cc7d970d99eb242dbe2d.1543256567@localhost.localdomain>
Download mbox | patch
Permalink /patch/36779/
State Accepted
Headers show

Comments

Boris Feld - Nov. 26, 2018, 6:22 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 cc7d970d99eb242dbe2d8e792a9212aabd06911f
# Parent  7f04e7e8eea72eb588d9460df7c0f2b72941b760
# EXP-Topic vfs.audit-rename
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r cc7d970d99eb
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))