[PATCH 1 of 6 V2] scmutil: rename classes from "opener" to "vfs"

FUJIWARA Katsunori foozy at lares.dti.ne.jp
Tue Aug 14 07:30:33 CDT 2012


# HG changeset patch
# User FUJIWARA Katsunori <foozy at lares.dti.ne.jp>
# Date 1344947111 -32400
# Branch stable
# Node ID 9d9fefcad3f1eae3f31c6664115f951182ab3dab
# Parent  7f5094bb3f423fc799e471aac2aee81a7ce57a0b
scmutil: rename classes from "opener" to "vfs"

For backwards compatibility, aliases for the old names are added,
except for "abstractopener", "statichttpopener" and "_fncacheopener",
because these are not used in Mercurial core implementation after this
patch.

"_fncacheopener" was only referred in "fncachestore" constructor, so
this patch also renames from "_fncacheopener" to "_fncachevfs" there.

diff -r 7f5094bb3f42 -r 9d9fefcad3f1 mercurial/scmutil.py
--- a/mercurial/scmutil.py	Wed Aug 01 15:12:22 2012 +0200
+++ b/mercurial/scmutil.py	Tue Aug 14 21:25:11 2012 +0900
@@ -167,7 +167,7 @@
         # want to add "foo/bar/baz" before checking if there's a "foo/.hg"
         self.auditeddir.update(prefixes)
 
-class abstractopener(object):
+class abstractvfs(object):
     """Abstract base class; cannot be instantiated"""
 
     def __init__(self, *args, **kwargs):
@@ -219,8 +219,8 @@
     def makedirs(self, path=None, mode=None):
         return util.makedirs(self.join(path), mode)
 
-class opener(abstractopener):
-    '''Open files relative to a base directory
+class vfs(abstractvfs):
+    '''Operate files relative to a base directory
 
     This class is used to hide the details of COW semantics and
     remote file access from higher level code.
@@ -327,8 +327,10 @@
         else:
             return self.base
 
-class filteropener(abstractopener):
-    '''Wrapper opener for filtering filenames with a function.'''
+opener = vfs
+
+class filtervfs(abstractvfs):
+    '''Wrapper vfs for filtering filenames with a function.'''
 
     def __init__(self, opener, filter):
         self._filter = filter
@@ -337,6 +339,8 @@
     def __call__(self, path, *args, **kwargs):
         return self._orig(self._filter(path), *args, **kwargs)
 
+filteropener = filtervfs
+
 def canonpath(root, cwd, myname, auditor=None):
     '''return the canonical path of myname, given cwd and root'''
     if util.endswithsep(root):
diff -r 7f5094bb3f42 -r 9d9fefcad3f1 mercurial/statichttprepo.py
--- a/mercurial/statichttprepo.py	Wed Aug 01 15:12:22 2012 +0200
+++ b/mercurial/statichttprepo.py	Tue Aug 14 21:25:11 2012 +0900
@@ -64,7 +64,7 @@
     urlopener = url.opener(ui, authinfo)
     urlopener.add_handler(byterange.HTTPRangeHandler())
 
-    class statichttpopener(scmutil.abstractopener):
+    class statichttpvfs(scmutil.abstractvfs):
         def __init__(self, base):
             self.base = base
 
@@ -74,7 +74,7 @@
             f = "/".join((self.base, urllib.quote(path)))
             return httprangereader(f, urlopener)
 
-    return statichttpopener
+    return statichttpvfs
 
 class statichttppeer(localrepo.localpeer):
     def local(self):
diff -r 7f5094bb3f42 -r 9d9fefcad3f1 mercurial/store.py
--- a/mercurial/store.py	Wed Aug 01 15:12:22 2012 +0200
+++ b/mercurial/store.py	Tue Aug 14 21:25:11 2012 +0900
@@ -367,7 +367,7 @@
             self._load()
         return iter(self.entries)
 
-class _fncacheopener(scmutil.abstractopener):
+class _fncachevfs(scmutil.abstractvfs):
     def __init__(self, op, fnc, encode):
         self.opener = op
         self.fncache = fnc
@@ -387,7 +387,7 @@
         op.createmode = self.createmode
         fnc = fncache(op)
         self.fncache = fnc
-        self.opener = _fncacheopener(op, fnc, encode)
+        self.opener = _fncachevfs(op, fnc, encode)
 
     def join(self, f):
         return self.path + '/' + self.encode(f)


More information about the Mercurial-devel mailing list