Show More
@@ -11,7 +11,7 b' import os.path' | |||||
11 | import mimetypes |
|
11 | import mimetypes | |
12 | from mercurial.demandload import demandload |
|
12 | from mercurial.demandload import demandload | |
13 | demandload(globals(), "re zlib ConfigParser mimetools cStringIO sys tempfile") |
|
13 | demandload(globals(), "re zlib ConfigParser mimetools cStringIO sys tempfile") | |
14 | demandload(globals(), 'urllib') |
|
14 | demandload(globals(), 'urllib bz2') | |
15 | demandload(globals(), "mercurial:mdiff,ui,hg,util,archival,streamclone,patch") |
|
15 | demandload(globals(), "mercurial:mdiff,ui,hg,util,archival,streamclone,patch") | |
16 | demandload(globals(), "mercurial:revlog,templater") |
|
16 | demandload(globals(), "mercurial:revlog,templater") | |
17 | demandload(globals(), "mercurial.hgweb.common:get_mtime,staticfile,style_map") |
|
17 | demandload(globals(), "mercurial.hgweb.common:get_mtime,staticfile,style_map") | |
@@ -1021,7 +1021,7 b' class hgweb(object):' | |||||
1021 | or self.t("error", error="%r not found" % fname)) |
|
1021 | or self.t("error", error="%r not found" % fname)) | |
1022 |
|
1022 | |||
1023 | def do_capabilities(self, req): |
|
1023 | def do_capabilities(self, req): | |
1024 | caps = ['unbundle', 'lookup', 'changegroupsubset'] |
|
1024 | caps = ['unbundle', 'lookup', 'changegroupsubset', 'standardbundle'] | |
1025 | if self.configbool('server', 'uncompressed'): |
|
1025 | if self.configbool('server', 'uncompressed'): | |
1026 | caps.append('stream=%d' % self.repo.revlogversion) |
|
1026 | caps.append('stream=%d' % self.repo.revlogversion) | |
1027 | resp = ' '.join(caps) |
|
1027 | resp = ' '.join(caps) | |
@@ -1101,6 +1101,38 b' class hgweb(object):' | |||||
1101 | return |
|
1101 | return | |
1102 |
|
1102 | |||
1103 | fp.seek(0) |
|
1103 | fp.seek(0) | |
|
1104 | header = fp.read(6) | |||
|
1105 | print repr(header) | |||
|
1106 | if not header.startswith("HG"): | |||
|
1107 | # old client with uncompressed bundle | |||
|
1108 | def generator(f): | |||
|
1109 | yield header | |||
|
1110 | for chunk in f: | |||
|
1111 | yield chunk | |||
|
1112 | elif not header.startswith("HG10"): | |||
|
1113 | req.write("0\n") | |||
|
1114 | req.write(_("unknown bundle version\n")) | |||
|
1115 | return | |||
|
1116 | elif header == "HG10GZ": | |||
|
1117 | def generator(f): | |||
|
1118 | zd = zlib.decompressobj() | |||
|
1119 | for chunk in f: | |||
|
1120 | yield zd.decompress(chunk) | |||
|
1121 | elif header == "HG10BZ": | |||
|
1122 | def generator(f): | |||
|
1123 | zd = bz2.BZ2Decompressor() | |||
|
1124 | zd.decompress("BZ") | |||
|
1125 | for chunk in f: | |||
|
1126 | yield zd.decompress(chunk) | |||
|
1127 | elif header == "HG10UN": | |||
|
1128 | def generator(f): | |||
|
1129 | for chunk in f: | |||
|
1130 | yield chunk | |||
|
1131 | else: | |||
|
1132 | req.write("0\n") | |||
|
1133 | req.write(_("unknown bundle compression type\n")) | |||
|
1134 | return | |||
|
1135 | gen = generator(util.filechunkiter(fp, 4096)) | |||
1104 |
|
1136 | |||
1105 | # send addchangegroup output to client |
|
1137 | # send addchangegroup output to client | |
1106 |
|
1138 | |||
@@ -1110,7 +1142,8 b' class hgweb(object):' | |||||
1110 | try: |
|
1142 | try: | |
1111 | url = 'remote:%s:%s' % (proto, |
|
1143 | url = 'remote:%s:%s' % (proto, | |
1112 | req.env.get('REMOTE_HOST', '')) |
|
1144 | req.env.get('REMOTE_HOST', '')) | |
1113 |
ret = self.repo.addchangegroup( |
|
1145 | ret = self.repo.addchangegroup(util.chunkbuffer(gen), | |
|
1146 | 'serve', url) | |||
1114 | finally: |
|
1147 | finally: | |
1115 | val = sys.stdout.getvalue() |
|
1148 | val = sys.stdout.getvalue() | |
1116 | sys.stdout = old_stdout |
|
1149 | sys.stdout = old_stdout |
General Comments 0
You need to be logged in to leave comments.
Login now