Show up archive link

TK Soh teekaysoh at yahoo.com
Thu Jun 1 10:04:07 CDT 2006


--- Vadim Gelfer <vadim.gelfer at gmail.com> wrote:
> On 5/31/06, TK Soh <teekaysoh at yahoo.com> wrote:
> 
> > Here's the revised patch:
> 
> sorry, i pulled eric hopper hgweb breakup before i seen your patch.
> your patch is not applying clean now, we have to wait for merge across
> rename before i can apply against older parent and automerge.
> 
> please resend and i will put in crew.

I was hoping I could beat Eric to it ;-) In any case, I also found a bug in my
original patch. So, here you go...

# HG changeset patch
# User TK Soh <teekaysoh at yahoo.com>
# Date 1149174144 18000
# Node ID 6e79a257cfab4793daeb863217ebbcaf06807f69
# Parent  e1674dbf4845d4525b263c0cf0e5fec1c4a0dd10
hgweb: add allow_archive support to [web] section of hgrc

diff -r e1674dbf4845 -r 6e79a257cfab doc/hgrc.5.txt
--- a/doc/hgrc.5.txt	Thu Jun 01 09:14:27 2006 -0500
+++ b/doc/hgrc.5.txt	Thu Jun 01 10:02:24 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 e1674dbf4845 -r 6e79a257cfab mercurial/hgweb/hgweb_mod.py
--- a/mercurial/hgweb/hgweb_mod.py	Thu Jun 01 09:14:27 2006 -0500
+++ b/mercurial/hgweb/hgweb_mod.py	Thu Jun 01 10:02:24 2006 -0500
@@ -48,8 +48,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):
@@ -803,8 +804,9 @@ class hgweb(object):
         elif cmd == 'archive':
             changeset = self.repo.lookup(req.form['node'][0])
             type = req.form['type'][0]
-            if (type in self.archives and
-                self.repo.ui.configbool("web", "allow" + type, False)):
+            allowed = self.repo.ui.config("web", "allow_archive", "").split()
+            if (type in self.archives and (type in allowed or
+                self.repo.ui.configbool("web", "allow" + type, False))):
                 self.archive(req, changeset, type)
                 return
 
diff -r e1674dbf4845 -r 6e79a257cfab mercurial/hgweb/hgwebdir_mod.py
--- a/mercurial/hgweb/hgwebdir_mod.py	Thu Jun 01 09:14:27 2006 -0500
+++ b/mercurial/hgweb/hgwebdir_mod.py	Thu Jun 01 10:02:24 2006 -0500
@@ -60,8 +60,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