Show up archive link

TK Soh teekaysoh at yahoo.com
Wed May 31 13:22:50 CDT 2006


--- Bryan O'Sullivan <bos at serpentine.com> wrote:
> On Fri, 2006-05-19 at 16:45 -0500, TK Soh wrote:
> 
> > OT (I've wanted to ask this): these allow* names elude me all the
> > time. Wouldn't it be better to consolidate them into something like
> > this?
> > 
> >     allow-archive = bz2 gz zip
> 
> Yes.

See if this patch is okay for you:

# HG changeset patch
# User TK Soh <teekaysoh at yahoo.com>
# Date 1149099518 18000
# Node ID 3938e45a706d03299309d1d8f05a32551e71b6ed
# Parent  61909dfb316da52e0069e8cf92cfc81cffc21523
hgweb: add 'allow-archive' support to [web] section of hgrc

diff -r 61909dfb316d -r 3938e45a706d doc/hgrc.5.txt
--- a/doc/hgrc.5.txt	Mon May 29 16:46:31 2006 +0800
+++ b/doc/hgrc.5.txt	Wed May 31 13:18:38 2006 -0500
@@ -362,15 +362,20 @@ web::
     Where to output the access log. Default is stdout.
   address;;
     Interface address to bind to. Default is all.
+  allow-archive;;
+    List of archieve format (bz2, gz, zip) allowed for downloading. 
+    Default is empty.
   allowbz2;;
-    Whether to allow .tar.bz2 downloading of repo revisions. Default is false.
+    (DEPRECATED) Whether to allow .tar.bz2 downloading of repo revisions.
+    Default is false.
   allowgz;;
-    Whether to allow .tar.gz downloading of repo revisions. Default is false.
+    (DEPRECATED) Whether to allow .tar.gz downloading of repo revisions.
+    Default is false.
   allowpull;;
     Whether to allow pulling from the repository. Default is true.
   allowzip;;
-    Whether to allow .zip downloading of repo revisions. Default is false.
-    This feature creates temporary files.
+    (DEPRECATED) Whether to allow .zip downloading of repo revisions. 
+    Default is false. This feature creates temporary files.
   baseurl;;
     Base URL to use when publishing URLs in other locations, so
     third-party tools like email notification hooks can construct URLs.
diff -r 61909dfb316d -r 3938e45a706d mercurial/hgweb/__init__.py
--- a/mercurial/hgweb/__init__.py	Mon May 29 16:46:31 2006 +0800
+++ b/mercurial/hgweb/__init__.py	Wed May 31 13:18:38 2006 -0500
@@ -123,8 +123,9 @@ class hgweb(object):
             self.allowpull = self.repo.ui.configbool("web", "allowpull", True)
 
     def archivelist(self, nodeid):
+        al = self.repo.ui.config("web", "allow-archive", "").split()
         for i in self.archives:
-            if self.repo.ui.configbool("web", "allow" + i, False):
+            if i in al or self.repo.ui.configbool("web", "allow" + i, False):
                 yield {"type" : i, "node" : nodeid, "url": ""}
 
     def listfiles(self, files, mf):
@@ -1049,8 +1050,9 @@ class hgwebdir(object):
                                              "footer": footer})
 
         def archivelist(ui, nodeid, url):
+            al = ui.config("web", "allow-archive", "").split()
             for i in ['zip', 'gz', 'bz2']:
-                if ui.configbool("web", "allow" + i, False):
+                if i in al or ui.configbool("web", "allow" + i, False):
                     yield {"type" : i, "node": nodeid, "url": url}
 
         def entries(sortcolumn="", descending=False, **map):


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


More information about the Mercurial mailing list