# HG changeset patch # User Bryan O'Sullivan # Date 2012-10-22 18:59:11 # Node ID 408ded42c5ec43d6f9cbc2eebe2c8a5c46ed4374 # Parent b32e55e6c3c729c1eb0658a0c3bc109259bfdae6 scmutil: abstract out mustaudit delegation diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py --- a/mercurial/scmutil.py +++ b/mercurial/scmutil.py @@ -348,6 +348,18 @@ class vfs(abstractvfs): opener = vfs +class auditvfs(object): + def __init__(self, vfs): + self.vfs = vfs + + def _getmustaudit(self): + return self.vfs.mustaudit + + def _setmustaudit(self, onoff): + self.vfs.mustaudit = onoff + + mustaudit = property(_getmustaudit, _setmustaudit) + class filtervfs(abstractvfs): '''Wrapper vfs for filtering filenames with a function.''' diff --git a/mercurial/store.py b/mercurial/store.py --- a/mercurial/store.py +++ b/mercurial/store.py @@ -436,20 +436,12 @@ class fncache(object): self._load() return iter(self.entries) -class _fncachevfs(scmutil.abstractvfs): +class _fncachevfs(scmutil.abstractvfs, scmutil.auditvfs): def __init__(self, vfs, fnc, encode): - self.vfs = vfs + scmutil.auditvfs.__init__(self, vfs) self.fncache = fnc self.encode = encode - def _getmustaudit(self): - return self.vfs.mustaudit - - def _setmustaudit(self, onoff): - self.vfs.mustaudit = onoff - - mustaudit = property(_getmustaudit, _setmustaudit) - def __call__(self, path, mode='r', *args, **kw): if mode not in ('r', 'rb') and path.startswith('data/'): self.fncache.add(path)