Mercurial > hg
changeset 6780:4c1d67e0fa8c
hgweb: move capabilities calculation back into hgweb.protocol
author | Dirkjan Ochtman <dirkjan@ochtman.nl> |
---|---|
date | Sun, 29 Jun 2008 11:35:08 +0200 |
parents | d3147b4e3e8a |
children | b4b7261164d5 |
files | mercurial/hgweb/hgweb_mod.py mercurial/hgweb/protocol.py |
diffstat | 2 files changed, 9 insertions(+), 17 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/hgweb/hgweb_mod.py Sun Jun 29 11:35:06 2008 +0200 +++ b/mercurial/hgweb/hgweb_mod.py Sun Jun 29 11:35:08 2008 +0200 @@ -10,7 +10,7 @@ from mercurial.node import hex, nullid from mercurial.repo import RepoError from mercurial import mdiff, ui, hg, util, patch, hook -from mercurial import revlog, templater, templatefilters, changegroup +from mercurial import revlog, templater, templatefilters from common import get_mtime, style_map, paritygen, countgen, ErrorResponse from common import HTTP_OK, HTTP_BAD_REQUEST, HTTP_NOT_FOUND, HTTP_SERVER_ERROR from request import wsgirequest @@ -36,7 +36,6 @@ self.reponame = name self.archives = 'zip', 'gz', 'bz2' self.stripecount = 1 - self._capabilities = None # a repo owner may set web.templates in .hg/hgrc to get any file # readable by the user running the CGI script self.templatepath = self.config("web", "templates", @@ -68,18 +67,6 @@ self.maxfiles = int(self.config("web", "maxfiles", 10)) self.allowpull = self.configbool("web", "allowpull", True) self.encoding = self.config("web", "encoding", util._encoding) - self._capabilities = None - - def capabilities(self): - if self._capabilities is not None: - return self._capabilities - caps = ['lookup', 'changegroupsubset'] - if self.configbool('server', 'uncompressed'): - caps.append('stream=%d' % self.repo.changelog.version) - if changegroup.bundlepriority: - caps.append('unbundle=%s' % ','.join(changegroup.bundlepriority)) - self._capabilities = caps - return caps def run(self): if not os.environ.get('GATEWAY_INTERFACE', '').startswith("CGI/1."):
--- a/mercurial/hgweb/protocol.py Sun Jun 29 11:35:06 2008 +0200 +++ b/mercurial/hgweb/protocol.py Sun Jun 29 11:35:08 2008 +0200 @@ -97,9 +97,14 @@ req.write(z.flush()) def capabilities(web, req): - resp = ' '.join(web.capabilities()) - req.respond(HTTP_OK, HGTYPE, length=len(resp)) - req.write(resp) + caps = ['lookup', 'changegroupsubset'] + if web.repo.ui.configbool('server', 'uncompressed', untrusted=True): + caps.append('stream=%d' % web.repo.changelog.version) + if changegroupmod.bundlepriority: + caps.append('unbundle=%s' % ','.join(changegroupmod.bundlepriority)) + rsp = ' '.join(caps) + req.respond(HTTP_OK, HGTYPE, length=len(rsp)) + req.write(rsp) def unbundle(web, req):