Mercurial > hg
comparison mercurial/statichttprepo.py @ 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 | 1d710fe5ee0e |
children | ffd589d4b785 |
comparison
equal
deleted
inserted
replaced
17648:07f1ac17b722 | 17649:f65c6a5f256c |
---|---|
62 def build_opener(ui, authinfo): | 62 def build_opener(ui, authinfo): |
63 # urllib cannot handle URLs with embedded user or passwd | 63 # urllib cannot handle URLs with embedded user or passwd |
64 urlopener = url.opener(ui, authinfo) | 64 urlopener = url.opener(ui, authinfo) |
65 urlopener.add_handler(byterange.HTTPRangeHandler()) | 65 urlopener.add_handler(byterange.HTTPRangeHandler()) |
66 | 66 |
67 class statichttpopener(scmutil.abstractopener): | 67 class statichttpvfs(scmutil.abstractvfs): |
68 def __init__(self, base): | 68 def __init__(self, base): |
69 self.base = base | 69 self.base = base |
70 | 70 |
71 def __call__(self, path, mode="r", atomictemp=None): | 71 def __call__(self, path, mode="r", atomictemp=None): |
72 if mode not in ('r', 'rb'): | 72 if mode not in ('r', 'rb'): |
73 raise IOError('Permission denied') | 73 raise IOError('Permission denied') |
74 f = "/".join((self.base, urllib.quote(path))) | 74 f = "/".join((self.base, urllib.quote(path))) |
75 return httprangereader(f, urlopener) | 75 return httprangereader(f, urlopener) |
76 | 76 |
77 return statichttpopener | 77 return statichttpvfs |
78 | 78 |
79 class statichttppeer(localrepo.localpeer): | 79 class statichttppeer(localrepo.localpeer): |
80 def local(self): | 80 def local(self): |
81 return None | 81 return None |
82 def canpush(self): | 82 def canpush(self): |