changeset 17845:408ded42c5ec stable

scmutil: abstract out mustaudit delegation
author Bryan O'Sullivan <bryano@fb.com>
date Mon, 22 Oct 2012 11:59:11 -0700
parents b32e55e6c3c7
children f42cf30873dc
files mercurial/scmutil.py mercurial/store.py
diffstat 2 files changed, 14 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/scmutil.py	Fri Oct 19 14:47:55 2012 -0500
+++ b/mercurial/scmutil.py	Mon Oct 22 11:59:11 2012 -0700
@@ -348,6 +348,18 @@
 
 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.'''
 
--- a/mercurial/store.py	Fri Oct 19 14:47:55 2012 -0500
+++ b/mercurial/store.py	Mon Oct 22 11:59:11 2012 -0700
@@ -436,20 +436,12 @@
             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)