##// END OF EJS Templates
http: query server for capabilities
Vadim Gelfer -
r2442:c660691f default
parent child Browse files
Show More
@@ -833,3 +833,9 b' class hgweb(object):'
833 "static"))
833 "static"))
834 req.write(staticfile(static, fname)
834 req.write(staticfile(static, fname)
835 or self.t("error", error="%r not found" % fname))
835 or self.t("error", error="%r not found" % fname))
836
837 def do_capabilities(self, req):
838 resp = ''
839 req.httphdr("application/mercurial-0.1", length=len(resp))
840 req.write(resp)
841
@@ -71,7 +71,7 b' def netlocunsplit(host, port, user=None,'
71
71
72 class httprepository(remoterepository):
72 class httprepository(remoterepository):
73 def __init__(self, ui, path):
73 def __init__(self, ui, path):
74 self.capabilities = ()
74 self.caps = None
75 scheme, netloc, urlpath, query, frag = urlparse.urlsplit(path)
75 scheme, netloc, urlpath, query, frag = urlparse.urlsplit(path)
76 if query or frag:
76 if query or frag:
77 raise util.Abort(_('unsupported URL component: "%s"') %
77 raise util.Abort(_('unsupported URL component: "%s"') %
@@ -145,6 +145,18 b' class httprepository(remoterepository):'
145 opener.addheaders = [('User-agent', 'mercurial/proto-1.0')]
145 opener.addheaders = [('User-agent', 'mercurial/proto-1.0')]
146 urllib2.install_opener(opener)
146 urllib2.install_opener(opener)
147
147
148 # look up capabilities only when needed
149
150 def get_caps(self):
151 if self.caps is None:
152 try:
153 self.caps = self.do_read('capabilities').split()
154 except hg.RepoError:
155 self.caps = ()
156 return self.caps
157
158 capabilities = property(get_caps)
159
148 def dev(self):
160 def dev(self):
149 return -1
161 return -1
150
162
General Comments 0
You need to be logged in to leave comments. Login now