# HG changeset patch # User Thomas Arendsen Hein # Date 1146470537 -7200 # Node ID 290534ee163c8416f914f71c809025bc578c0c2a # Parent 29eeb2717915701bac033df1a7409f28f4f2d6ca Add download links to hgwebdir index page for allowed archive types. Based on a patch by Colin McMillen diff --git a/mercurial/hgweb.py b/mercurial/hgweb.py --- a/mercurial/hgweb.py +++ b/mercurial/hgweb.py @@ -125,7 +125,7 @@ class hgweb(object): 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 @@ class hgwebdir(object): 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 @@ class hgwebdir(object): url=url, parity=parity, shortdesc=get("web", "description", "unknown"), - lastupdate=d) + lastupdate=d, + archives=archivelist(u, "tip", url)) parity = 1 - parity diff --git a/templates/map b/templates/map --- a/templates/map +++ b/templates/map @@ -43,8 +43,8 @@ filediffparent = '