hgweb: Added archive download buttons to manifest page.
authorThomas Arendsen Hein <thomas@intevation.de>
Thu, 03 Nov 2005 18:45:27 +0100
changeset 1498 78590fb4a82b
parent 1497 f0b13c019b04
child 1501 c5c4381d898b
child 1502 1170fef58071
hgweb: Added archive download buttons to manifest page.
mercurial/hgweb.py
templates/manifest.tmpl
--- a/mercurial/hgweb.py	Thu Nov 03 00:45:54 2005 -0800
+++ b/mercurial/hgweb.py	Thu Nov 03 18:45:27 2005 +0100
@@ -196,6 +196,11 @@
             self.maxfiles = int(self.repo.ui.config("web", "maxfiles", 10))
             self.allowpull = self.repo.ui.configbool("web", "allowpull", True)
 
+    def archivelist(self, nodeid):
+        for i in self.archives:
+            if self.repo.ui.configbool("web", "allow" + i, False):
+                yield {"type" : i, "node" : nodeid}
+
     def listfiles(self, files, mf):
         for f in files[:self.maxfiles]:
             yield self.t("filenodelink", node=hex(mf[f]), file=f)
@@ -414,11 +419,6 @@
         def diff(**map):
             yield self.diff(p1, n, None)
 
-        def archivelist():
-            for i in self.archives:
-                if self.repo.ui.configbool("web", "allow" + i, False):
-                    yield {"type" : i, "node" : nodeid}
-
         yield self.t('changeset',
                      diff=diff,
                      rev=cl.rev(n),
@@ -430,7 +430,7 @@
                      desc=changes[4],
                      date=changes[2],
                      files=files,
-                     archives=archivelist())
+                     archives=self.archivelist(nodeid))
 
     def filelog(self, f, filenode):
         cl = self.repo.changelog
@@ -618,7 +618,8 @@
                      path=path,
                      up=up(path),
                      fentries=filelist,
-                     dentries=dirlist)
+                     dentries=dirlist,
+                     archives=self.archivelist(hex(node)))
 
     def tags(self):
         cl = self.repo.changelog
--- a/templates/manifest.tmpl	Thu Nov 03 00:45:54 2005 -0800
+++ b/templates/manifest.tmpl	Thu Nov 03 18:45:27 2005 +0100
@@ -7,6 +7,7 @@
 <a href="?cl=#rev#">changelog</a>
 <a href="?tags=">tags</a>
 <a href="?cs=#node|short#">changeset</a>
+#archives%archiveentry#
 </div>
 
 <h2>manifest for changeset #node|short#: #path#</h2>