Mercurial > hg-stable
changeset 17649:f65c6a5f256c
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.
author | FUJIWARA Katsunori <foozy@lares.dti.ne.jp> |
---|---|
date | Fri, 31 Aug 2012 02:06:29 +0900 |
parents | 07f1ac17b722 |
children | bf2eb3a126d2 |
files | mercurial/scmutil.py mercurial/statichttprepo.py mercurial/store.py |
diffstat | 3 files changed, 13 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/scmutil.py Mon Aug 13 21:25:48 2012 +0900 +++ b/mercurial/scmutil.py Fri Aug 31 02:06:29 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. @@ -335,8 +335,10 @@ return path.startswith('/') and path or (self.basesep + path) 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 @@ -345,6 +347,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):
--- a/mercurial/statichttprepo.py Mon Aug 13 21:25:48 2012 +0900 +++ b/mercurial/statichttprepo.py Fri Aug 31 02:06:29 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):
--- a/mercurial/store.py Mon Aug 13 21:25:48 2012 +0900 +++ b/mercurial/store.py Fri Aug 31 02:06:29 2012 +0900 @@ -418,7 +418,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 @@ -451,7 +451,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.pathsep + self.encode(f)