diff mercurial/hgweb.py @ 2171:290534ee163c

Add download links to hgwebdir index page for allowed archive types. Based on a patch by Colin McMillen <mcmillen@cs.cmu.edu>
author Thomas Arendsen Hein <thomas@intevation.de>
date Mon, 01 May 2006 10:02:17 +0200
parents 29eeb2717915
children d1943df604c4
line wrap: on
line diff
--- a/mercurial/hgweb.py	Mon May 01 09:01:59 2006 +0200
+++ b/mercurial/hgweb.py	Mon May 01 10:02:17 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]:
@@ -1045,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:
@@ -1071,7 +1076,8 @@
                            url=url,
                            parity=parity,
                            shortdesc=get("web", "description", "unknown"),
-                           lastupdate=d)
+                           lastupdate=d,
+                           archives=archivelist(u, "tip", url))
 
                 parity = 1 - parity