617 'bz2': ('application/x-tar', 'tbz2', '.tar.bz2', None), |
617 'bz2': ('application/x-tar', 'tbz2', '.tar.bz2', None), |
618 'gz': ('application/x-tar', 'tgz', '.tar.gz', None), |
618 'gz': ('application/x-tar', 'tgz', '.tar.gz', None), |
619 'zip': ('application/zip', 'zip', '.zip', None), |
619 'zip': ('application/zip', 'zip', '.zip', None), |
620 } |
620 } |
621 |
621 |
622 def archive(self, req, id, type_): |
622 def archive(self, req, key, type_): |
623 reponame = re.sub(r"\W+", "-", os.path.basename(self.reponame)) |
623 reponame = re.sub(r"\W+", "-", os.path.basename(self.reponame)) |
624 cnode = self.repo.lookup(id) |
624 cnode = self.repo.lookup(key) |
625 arch_version = id |
625 arch_version = key |
626 if cnode == id or id == 'tip': |
626 if cnode == key or key == 'tip': |
627 arch_version = short(cnode) |
627 arch_version = short(cnode) |
628 name = "%s-%s" % (reponame, arch_version) |
628 name = "%s-%s" % (reponame, arch_version) |
629 mimetype, artype, extension, encoding = self.archive_specs[type_] |
629 mimetype, artype, extension, encoding = self.archive_specs[type_] |
630 headers = [('Content-type', mimetype), |
630 headers = [('Content-type', mimetype), |
631 ('Content-disposition', 'attachment; filename=%s%s' % |
631 ('Content-disposition', 'attachment; filename=%s%s' % |