Fixed [web] allow_archive for comma separated parameters by using ui.configlist.
Changed tests/test-archive to use allow_archive instead of the deprecated
allowzip, allowgz and allowbz2.
--- a/mercurial/hgweb/hgweb_mod.py Mon Jun 26 14:52:26 2006 +0200
+++ b/mercurial/hgweb/hgweb_mod.py Mon Jun 26 14:56:14 2006 +0200
@@ -50,8 +50,7 @@
self.allowpull = self.repo.ui.configbool("web", "allowpull", True)
def archivelist(self, nodeid):
- allowed = (self.repo.ui.config("web", "allow_archive", "")
- .replace(",", " ").split())
+ allowed = self.repo.ui.configlist("web", "allow_archive")
for i in self.archives:
if i in allowed or self.repo.ui.configbool("web", "allow" + i):
yield {"type" : i, "node" : nodeid, "url": ""}
@@ -818,7 +817,7 @@
def do_archive(self, req):
changeset = self.repo.lookup(req.form['node'][0])
type_ = req.form['type'][0]
- allowed = self.repo.ui.config("web", "allow_archive", "").split()
+ allowed = self.repo.ui.configlist("web", "allow_archive")
if (type_ in self.archives and (type_ in allowed or
self.repo.ui.configbool("web", "allow" + type_, False))):
self.archive(req, changeset, type_)
--- a/mercurial/hgweb/hgwebdir_mod.py Mon Jun 26 14:52:26 2006 +0200
+++ b/mercurial/hgweb/hgwebdir_mod.py Mon Jun 26 14:56:14 2006 +0200
@@ -60,8 +60,7 @@
"footer": footer})
def archivelist(ui, nodeid, url):
- allowed = (ui.config("web", "allow_archive", "")
- .replace(",", " ").split())
+ allowed = ui.configlist("web", "allow_archive")
for i in ['zip', 'gz', 'bz2']:
if i in allowed or ui.configbool("web", "allow" + i):
yield {"type" : i, "node": nodeid, "url": url}
--- a/tests/test-archive Mon Jun 26 14:52:26 2006 +0200
+++ b/tests/test-archive Mon Jun 26 14:56:14 2006 +0200
@@ -15,9 +15,7 @@
hg commit -m 3
echo "[web]" >> .hg/hgrc
echo "name = test-archive" >> .hg/hgrc
-echo "allowzip = true" >> .hg/hgrc
-echo "allowgz = true" >> .hg/hgrc
-echo "allowbz2 = true" >> .hg/hgrc
+echo "allow_archive = gz bz2, zip" >> .hg/hgrc
hg serve -p 20059 -d --pid-file=hg.pid
TIP=`hg id -v | cut -f1 -d' '`