##// END OF EJS Templates
hgweb: move capabilities calculation back into hgweb.protocol
Dirkjan Ochtman -
r6780:4c1d67e0 default
parent child Browse files
Show More
@@ -10,7 +10,7 b' import os, mimetypes'
10 10 from mercurial.node import hex, nullid
11 11 from mercurial.repo import RepoError
12 12 from mercurial import mdiff, ui, hg, util, patch, hook
13 from mercurial import revlog, templater, templatefilters, changegroup
13 from mercurial import revlog, templater, templatefilters
14 14 from common import get_mtime, style_map, paritygen, countgen, ErrorResponse
15 15 from common import HTTP_OK, HTTP_BAD_REQUEST, HTTP_NOT_FOUND, HTTP_SERVER_ERROR
16 16 from request import wsgirequest
@@ -36,7 +36,6 b' class hgweb(object):'
36 36 self.reponame = name
37 37 self.archives = 'zip', 'gz', 'bz2'
38 38 self.stripecount = 1
39 self._capabilities = None
40 39 # a repo owner may set web.templates in .hg/hgrc to get any file
41 40 # readable by the user running the CGI script
42 41 self.templatepath = self.config("web", "templates",
@@ -68,18 +67,6 b' class hgweb(object):'
68 67 self.maxfiles = int(self.config("web", "maxfiles", 10))
69 68 self.allowpull = self.configbool("web", "allowpull", True)
70 69 self.encoding = self.config("web", "encoding", util._encoding)
71 self._capabilities = None
72
73 def capabilities(self):
74 if self._capabilities is not None:
75 return self._capabilities
76 caps = ['lookup', 'changegroupsubset']
77 if self.configbool('server', 'uncompressed'):
78 caps.append('stream=%d' % self.repo.changelog.version)
79 if changegroup.bundlepriority:
80 caps.append('unbundle=%s' % ','.join(changegroup.bundlepriority))
81 self._capabilities = caps
82 return caps
83 70
84 71 def run(self):
85 72 if not os.environ.get('GATEWAY_INTERFACE', '').startswith("CGI/1."):
@@ -97,9 +97,14 b' def changegroupsubset(web, req):'
97 97 req.write(z.flush())
98 98
99 99 def capabilities(web, req):
100 resp = ' '.join(web.capabilities())
101 req.respond(HTTP_OK, HGTYPE, length=len(resp))
102 req.write(resp)
100 caps = ['lookup', 'changegroupsubset']
101 if web.repo.ui.configbool('server', 'uncompressed', untrusted=True):
102 caps.append('stream=%d' % web.repo.changelog.version)
103 if changegroupmod.bundlepriority:
104 caps.append('unbundle=%s' % ','.join(changegroupmod.bundlepriority))
105 rsp = ' '.join(caps)
106 req.respond(HTTP_OK, HGTYPE, length=len(rsp))
107 req.write(rsp)
103 108
104 109 def unbundle(web, req):
105 110
General Comments 0
You need to be logged in to leave comments. Login now