Submitter | Boris Feld |
---|---|
Date | Dec. 31, 2018, 5:37 p.m. |
Message ID | <6528ebfbd28f8fc36692.1546277849@Laptop-Boris.lan> |
Download | mbox | patch |
Permalink | /patch/37413/ |
State | Accepted |
Headers | show |
Comments
On Mon, 31 Dec 2018 18:37:29 +0100, Boris Feld wrote: > # HG changeset patch > # User Boris Feld <boris.feld@octobus.net> > # Date 1545828263 -3600 > # Wed Dec 26 13:44:23 2018 +0100 > # Node ID 6528ebfbd28f8fc3669257404eaa4b0aa2c2a2c8 > # Parent 5479d748f59531f6669290e092a12920cbcc8349 > # EXP-Topic vfs.audit-rename > # Available At https://bitbucket.org/octobus/mercurial-devel/ > # hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 6528ebfbd28f > vfs: add a `_auditpath` to abstract vfs Queued, thanks. > We are about to make `rename` audit path. Since rename lives in the > `abstractvfs` layer, we need it to be aware of auditing to some extent. > > The default implementation is no-op because multiple existing vfs are not using > auditing at all right now (eg: fncachevfs). Yep. I really don't understand how these vfs classes are designed. proxyvfs might have to forward _auditpath() to self.vfs. > @@ -46,6 +46,9 @@ class abstractvfs(object): > '''Prevent instantiation; don't call this from subclasses.''' > raise NotImplementedError('attempted instantiating ' + str(type(self))) > > + def _auditpath(self, path, mode): > + pass It's probably safer to raise NotImplementedError to catch typos.
Patch
diff --git a/mercurial/vfs.py b/mercurial/vfs.py --- a/mercurial/vfs.py +++ b/mercurial/vfs.py @@ -46,6 +46,9 @@ class abstractvfs(object): '''Prevent instantiation; don't call this from subclasses.''' raise NotImplementedError('attempted instantiating ' + str(type(self))) + def _auditpath(self, path, mode): + pass + def tryread(self, path): '''gracefully return an empty string for missing files''' try: