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): |