Mercurial > hg
changeset 4164:5c1e18bb804c
hgweb: use the given revision in the name of the archive
If you ask for an archive in hgweb by tagname the directory in the archive
should include the tagname not the changeset-id.
author | Michael Gebetsroither <michael.geb@gmx.at> |
---|---|
date | Thu, 08 Mar 2007 22:36:12 +0100 |
parents | b2d9e553cdc8 |
children | 0d0f098e5d51 |
files | mercurial/hgweb/hgweb_mod.py |
diffstat | 1 files changed, 7 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/hgweb/hgweb_mod.py Wed Mar 07 15:26:03 2007 -0300 +++ b/mercurial/hgweb/hgweb_mod.py Thu Mar 08 22:36:12 2007 +0100 @@ -606,9 +606,13 @@ 'zip': ('application/zip', 'zip', '.zip', None), } - def archive(self, req, cnode, type_): + def archive(self, req, id, type_): reponame = re.sub(r"\W+", "-", os.path.basename(self.reponame)) - name = "%s-%s" % (reponame, short(cnode)) + cnode = self.repo.lookup(id) + arch_version = id + if cnode == id: + arch_version = short(cnode) + name = "%s-%s" % (reponame, arch_version) mimetype, artype, extension, encoding = self.archive_specs[type_] headers = [('Content-type', mimetype), ('Content-disposition', 'attachment; filename=%s%s' % @@ -989,12 +993,11 @@ req.write(z.flush()) def do_archive(self, req): - changeset = self.repo.lookup(req.form['node'][0]) type_ = req.form['type'][0] allowed = self.configlist("web", "allow_archive") if (type_ in self.archives and (type_ in allowed or self.configbool("web", "allow" + type_, False))): - self.archive(req, changeset, type_) + self.archive(req, req.form['node'][0], type_) return req.write(self.t("error"))