[PATCH 1 of 2 in crew-stable] scmutil: abstract out mustaudit delegation

Bryan O'Sullivan bos at serpentine.com
Mon Oct 22 14:13:11 CDT 2012


# HG changeset patch
# User Bryan O'Sullivan <bryano at fb.com>
# Date 1350932351 25200
# Branch stable
# 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)


More information about the Mercurial-devel mailing list