Show More
@@ -53,6 +53,9 b' bundletypes = {' | |||
|
53 | 53 | "HG10GZ": ("HG10GZ", lambda: zlib.compressobj()), |
|
54 | 54 | } |
|
55 | 55 | |
|
56 | # hgweb uses this list to communicate it's preferred type | |
|
57 | bundlepriority = ['HG10GZ', 'HG10BZ', 'HG10UN'] | |
|
58 | ||
|
56 | 59 | def writebundle(cg, filename, bundletype): |
|
57 | 60 | """Write a bundle file and return its filename. |
|
58 | 61 |
@@ -9,7 +9,7 b'' | |||
|
9 | 9 | import os, mimetypes, re |
|
10 | 10 | from mercurial.node import * |
|
11 | 11 | from mercurial import mdiff, ui, hg, util, archival, patch, hook |
|
12 | from mercurial import revlog, templater, templatefilters | |
|
12 | from mercurial import revlog, templater, templatefilters, changegroup | |
|
13 | 13 | from common import get_mtime, style_map, paritygen, countgen, get_contact |
|
14 | 14 | from common import ErrorResponse |
|
15 | 15 | from common import HTTP_OK, HTTP_BAD_REQUEST, HTTP_NOT_FOUND, HTTP_SERVER_ERROR |
@@ -92,6 +92,7 b' class hgweb(object):' | |||
|
92 | 92 | self.reponame = name |
|
93 | 93 | self.archives = 'zip', 'gz', 'bz2' |
|
94 | 94 | self.stripecount = 1 |
|
95 | self._capabilities = None | |
|
95 | 96 | # a repo owner may set web.templates in .hg/hgrc to get any file |
|
96 | 97 | # readable by the user running the CGI script |
|
97 | 98 | self.templatepath = self.config("web", "templates", |
@@ -123,6 +124,18 b' class hgweb(object):' | |||
|
123 | 124 | self.maxfiles = int(self.config("web", "maxfiles", 10)) |
|
124 | 125 | self.allowpull = self.configbool("web", "allowpull", True) |
|
125 | 126 | self.encoding = self.config("web", "encoding", util._encoding) |
|
127 | self._capabilities = None | |
|
128 | ||
|
129 | def capabilities(self): | |
|
130 | if self._capabilities is not None: | |
|
131 | return self._capabilities | |
|
132 | caps = ['lookup', 'changegroupsubset'] | |
|
133 | if self.configbool('server', 'uncompressed'): | |
|
134 | caps.append('stream=%d' % self.repo.changelog.version) | |
|
135 | if changegroup.bundlepriority: | |
|
136 | caps.append('unbundle=%s' % ','.join(changegroup.bundlepriority)) | |
|
137 | self._capabilities = caps | |
|
138 | return caps | |
|
126 | 139 | |
|
127 | 140 | def run(self): |
|
128 | 141 | if not os.environ.get('GATEWAY_INTERFACE', '').startswith("CGI/1."): |
@@ -101,14 +101,7 b' def changegroupsubset(web, req):' | |||
|
101 | 101 | req.write(z.flush()) |
|
102 | 102 | |
|
103 | 103 | def capabilities(web, req): |
|
104 | caps = ['lookup', 'changegroupsubset'] | |
|
105 | if web.configbool('server', 'uncompressed'): | |
|
106 | caps.append('stream=%d' % web.repo.changelog.version) | |
|
107 | # XXX: make configurable and/or share code with do_unbundle: | |
|
108 | unbundleversions = ['HG10GZ', 'HG10BZ', 'HG10UN'] | |
|
109 | if unbundleversions: | |
|
110 | caps.append('unbundle=%s' % ','.join(unbundleversions)) | |
|
111 | resp = ' '.join(caps) | |
|
104 | resp = ' '.join(web.capabilities()) | |
|
112 | 105 | req.respond(HTTP_OK, HGTYPE, length=len(resp)) |
|
113 | 106 | req.write(resp) |
|
114 | 107 |
General Comments 0
You need to be logged in to leave comments.
Login now