[PATCH] another implementation of archives on hgwebdir index page

Thomas Arendsen Hein thomas at intevation.de
Mon May 1 03:07:08 CDT 2006


* Colin McMillen <mcmillen at cs.cmu.edu> [20060429 03:01]:
> # HG changeset patch
> # User Colin McMillen <mcmillen at cs.cmu.edu>
> # Node ID be475eac682316b4178fd3f93aab1251c4994d41
> # Parent  628bf85f07ee4751ee75a75bca3d88d563a228ec
> Add per-repo download links on index page without need to load entire repo.

This patch is missing the actual download links.

I pushed this to crew instead:

# HG changeset patch
# User Thomas Arendsen Hein <thomas at intevation.de>
# Node ID 290534ee163c8416f914f71c809025bc578c0c2a
# Parent  29eeb2717915701bac033df1a7409f28f4f2d6ca
Add download links to hgwebdir index page for allowed archive types.
Based on a patch by Colin McMillen <mcmillen at cs.cmu.edu>

diff -r 29eeb2717915 -r 290534ee163c mercurial/hgweb.py
--- 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 @@ 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 -r 29eeb2717915 -r 290534ee163c templates/map
--- a/templates/map	Mon May 01 09:01:59 2006 +0200
+++ b/templates/map	Mon May 01 10:02:17 2006 +0200
@@ -43,8 +43,8 @@ filelogparent = '<tr><th>parent #rev#:</
 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
diff -r 29eeb2717915 -r 290534ee163c templates/static/style.css
--- a/templates/static/style.css	Mon May 01 09:01:59 2006 +0200
+++ b/templates/static/style.css	Mon May 01 10:02:17 2006 +0200
@@ -1,5 +1,6 @@ a { text-decoration:none; }
 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; 

-- 
Email: thomas at intevation.de
http://intevation.de/~thomas/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://www.selenic.com/pipermail/mercurial/attachments/20060501/49e6b42c/attachment.pgp


More information about the Mercurial mailing list