[PATCH 2 of 9] store: rename field name from "opener" to "vfs" in internal classes for fncache

FUJIWARA Katsunori foozy at lares.dti.ne.jp
Mon Oct 8 12:06:12 CDT 2012


# HG changeset patch
# User FUJIWARA Katsunori <foozy at lares.dti.ne.jp>
# Date 1349714515 -32400
# Node ID fa1096df9fbe91d4dc526d2da4a9b5354a5cc4ec
# Parent  f727b84e4918d886fd6e9d3bde93fcb515ff7802
store: rename field name from "opener" to "vfs" in internal classes for fncache

These fields are used only in store module, so keeping "self.opener"
for backward compatibility like as "localrepository" class is not
needed.

diff -r f727b84e4918 -r fa1096df9fbe mercurial/store.py
--- a/mercurial/store.py	Tue Oct 09 01:41:55 2012 +0900
+++ b/mercurial/store.py	Tue Oct 09 01:41:55 2012 +0900
@@ -367,8 +367,8 @@
 class fncache(object):
     # the filename used to be partially encoded
     # hence the encodedir/decodedir dance
-    def __init__(self, opener):
-        self.opener = opener
+    def __init__(self, vfs):
+        self.vfs = vfs
         self.entries = None
         self._dirty = False
 
@@ -376,7 +376,7 @@
         '''fill the entries from the fncache file'''
         self._dirty = False
         try:
-            fp = self.opener('fncache', mode='rb')
+            fp = self.vfs('fncache', mode='rb')
         except IOError:
             # skip nonexistent file
             self.entries = set()
@@ -391,7 +391,7 @@
         fp.close()
 
     def _write(self, files, atomictemp):
-        fp = self.opener('fncache', mode='wb', atomictemp=atomictemp)
+        fp = self.vfs('fncache', mode='wb', atomictemp=atomictemp)
         if files:
             fp.write(encodedir('\n'.join(files) + '\n'))
         fp.close()
@@ -424,22 +424,22 @@
 
 class _fncachevfs(scmutil.abstractvfs):
     def __init__(self, vfs, fnc, encode):
-        self.opener = vfs
+        self.vfs = vfs
         self.fncache = fnc
         self.encode = encode
 
     def _getmustaudit(self):
-        return self.opener.mustaudit
+        return self.vfs.mustaudit
 
     def _setmustaudit(self, onoff):
-        self.opener.mustaudit = 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)
-        return self.opener(self.encode(path), mode, *args, **kw)
+        return self.vfs(self.encode(path), mode, *args, **kw)
 
 class fncachestore(basicstore):
     def __init__(self, path, vfstype, dotencode):


More information about the Mercurial-devel mailing list