--- a/mercurial/hgweb/hgweb_mod.py Wed Feb 20 13:38:16 2008 -0800
+++ b/mercurial/hgweb/hgweb_mod.py Thu Feb 21 15:00:25 2008 +0100
@@ -9,7 +9,7 @@
import os, mimetypes, re
from mercurial.node import *
from mercurial import mdiff, ui, hg, util, archival, patch, hook
-from mercurial import revlog, templater, templatefilters
+from mercurial import revlog, templater, templatefilters, changegroup
from common import get_mtime, style_map, paritygen, countgen, get_contact
from common import ErrorResponse
from common import HTTP_OK, HTTP_BAD_REQUEST, HTTP_NOT_FOUND, HTTP_SERVER_ERROR
@@ -92,6 +92,7 @@
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",
@@ -123,6 +124,18 @@
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."):