--- a/mercurial/archival.py Sun Apr 30 16:30:57 2006 -0700
+++ b/mercurial/archival.py Mon May 01 10:04:25 2006 +0200
@@ -80,8 +80,11 @@
def __init__(self, dest, prefix, compress=True):
self.prefix = tidyprefix(dest, prefix, ('.zip',))
- if not isinstance(dest, str) and not hasattr(dest, 'tell'):
- dest = tellable(dest)
+ if not isinstance(dest, str):
+ try:
+ dest.tell()
+ except (AttributeError, IOError):
+ dest = tellable(dest)
self.z = zipfile.ZipFile(dest, 'w',
compress and zipfile.ZIP_DEFLATED or
zipfile.ZIP_STORED)
--- a/mercurial/hgweb.py Sun Apr 30 16:30:57 2006 -0700
+++ b/mercurial/hgweb.py Mon May 01 10:04:25 2006 +0200
@@ -125,7 +125,7 @@
def archivelist(self, nodeid):
for i in self.archives:
if self.repo.ui.configbool("web", "allow" + i, False):
- yield {"type" : i, "node" : nodeid}
+ yield {"type" : i, "node" : nodeid, "url": ""}
def listfiles(self, files, mf):
for f in files[:self.maxfiles]:
@@ -293,7 +293,8 @@
yield self.t('changelog',
changenav=changenav,
manifest=hex(mf),
- rev=pos, changesets=count, entries=changelist)
+ rev=pos, changesets=count, entries=changelist,
+ archives=self.archivelist("tip"))
def search(self, query):
@@ -1044,6 +1045,11 @@
defaults={"header": header,
"footer": footer})
+ def archivelist(ui, nodeid, url):
+ for i in ['zip', 'gz', 'bz2']:
+ if ui.configbool("web", "allow" + i, False):
+ yield {"type" : i, "node": nodeid, "url": url}
+
def entries(**map):
parity = 0
for name, path in self.repos:
@@ -1070,7 +1076,8 @@
url=url,
parity=parity,
shortdesc=get("web", "description", "unknown"),
- lastupdate=d)
+ lastupdate=d,
+ archives=archivelist(u, "tip", url))
parity = 1 - parity
--- a/templates/changelog.tmpl Sun Apr 30 16:30:57 2006 -0700
+++ b/templates/changelog.tmpl Mon May 01 10:04:25 2006 +0200
@@ -8,6 +8,7 @@
<div class="buttons">
<a href="?cmd=tags">tags</a>
<a href="?mf=#manifest|short#;path=/">manifest</a>
+#archives%archiveentry#
<a type="application/rss+xml" href="?style=rss">rss</a>
</div>
--- a/templates/map Sun Apr 30 16:30:57 2006 -0700
+++ b/templates/map Mon May 01 10:04:25 2006 +0200
@@ -43,8 +43,8 @@
filelogparent = '<tr><th>parent #rev#:</th><td><a href="?f=#node|short#;file=#file|urlescape#">#node|short#</a></td></tr>'
filediffchild = '<tr><th class="child">child #rev#:</th><td class="child"><a href="?cs=#node|short#">#node|short#</a></td></tr>'
filelogchild = '<tr><th>child #rev#:</th><td><a href="?f=#node|short#;file=#file|urlescape#">#node|short#</a></td></tr>'
-indexentry = '<tr class="parity#parity#"><td><a href="#url#">#name|escape#</a></td><td>#shortdesc#</td><td>#contact|obfuscate#</td><td class="age">#lastupdate|age# ago</td><td><a href="#url#?cl=tip;style=rss">RSS</a></td></tr>'
+indexentry = '<tr class="parity#parity#"><td><a href="#url#">#name|escape#</a></td><td>#shortdesc#</td><td>#contact|obfuscate#</td><td class="age">#lastupdate|age# ago</td><td class="indexlinks"><a href="#url#?cl=tip;style=rss">RSS</a> #archives%archiveentry#</td></tr>'
index = index.tmpl
-archiveentry = '<a href="?ca=#node|short#;type=#type|urlescape#">#type|escape#</a> '
+archiveentry = '<a href="#url#?ca=#node|short#;type=#type|urlescape#">#type|escape#</a> '
notfound = notfound.tmpl
error = error.tmpl
--- a/templates/static/style.css Sun Apr 30 16:30:57 2006 -0700
+++ b/templates/static/style.css Mon May 01 10:04:25 2006 +0200
@@ -1,5 +1,6 @@
a { text-decoration:none; }
.age { white-space:nowrap; }
+.indexlinks { white-space:nowrap; }
.parity0 { background-color: #dddddd; }
.parity1 { background-color: #eeeeee; }
.lineno { width: 60px; color: #aaaaaa; font-size: smaller;