1109 arch_version = short(cnode) |
1109 arch_version = short(cnode) |
1110 name = "%s-%s" % (reponame, arch_version) |
1110 name = "%s-%s" % (reponame, arch_version) |
1111 |
1111 |
1112 ctx = webutil.changectx(web.repo, req) |
1112 ctx = webutil.changectx(web.repo, req) |
1113 pats = [] |
1113 pats = [] |
1114 matchfn = scmutil.match(ctx, []) |
1114 match = scmutil.match(ctx, []) |
1115 file = req.form.get('file', None) |
1115 file = req.form.get('file', None) |
1116 if file: |
1116 if file: |
1117 pats = ['path:' + file[0]] |
1117 pats = ['path:' + file[0]] |
1118 matchfn = scmutil.match(ctx, pats, default='path') |
1118 match = scmutil.match(ctx, pats, default='path') |
1119 if pats: |
1119 if pats: |
1120 files = [f for f in ctx.manifest().keys() if matchfn(f)] |
1120 files = [f for f in ctx.manifest().keys() if match(f)] |
1121 if not files: |
1121 if not files: |
1122 raise ErrorResponse(HTTP_NOT_FOUND, |
1122 raise ErrorResponse(HTTP_NOT_FOUND, |
1123 'file(s) not found: %s' % file[0]) |
1123 'file(s) not found: %s' % file[0]) |
1124 |
1124 |
1125 mimetype, artype, extension, encoding = web.archivespecs[type_] |
1125 mimetype, artype, extension, encoding = web.archivespecs[type_] |
1130 headers.append(('Content-Encoding', encoding)) |
1130 headers.append(('Content-Encoding', encoding)) |
1131 req.headers.extend(headers) |
1131 req.headers.extend(headers) |
1132 req.respond(HTTP_OK, mimetype) |
1132 req.respond(HTTP_OK, mimetype) |
1133 |
1133 |
1134 archival.archive(web.repo, req, cnode, artype, prefix=name, |
1134 archival.archive(web.repo, req, cnode, artype, prefix=name, |
1135 matchfn=matchfn, |
1135 matchfn=match, |
1136 subrepos=web.configbool("web", "archivesubrepos")) |
1136 subrepos=web.configbool("web", "archivesubrepos")) |
1137 return [] |
1137 return [] |
1138 |
1138 |
1139 |
1139 |
1140 @webcommand('static') |
1140 @webcommand('static') |