##// END OF EJS Templates
hgweb: add allow_archive support to [web] section of hgrc
TK Soh -
r2358:8819fc1d default
parent child Browse files
Show More
@@ -362,15 +362,20 b' web::'
362 Where to output the access log. Default is stdout.
362 Where to output the access log. Default is stdout.
363 address;;
363 address;;
364 Interface address to bind to. Default is all.
364 Interface address to bind to. Default is all.
365 allow_archive;;
366 List of archive format (bz2, gz, zip) allowed for downloading.
367 Default is empty.
365 allowbz2;;
368 allowbz2;;
366 Whether to allow .tar.bz2 downloading of repo revisions. Default is false.
369 (DEPRECATED) Whether to allow .tar.bz2 downloading of repo revisions.
370 Default is false.
367 allowgz;;
371 allowgz;;
368 Whether to allow .tar.gz downloading of repo revisions. Default is false.
372 (DEPRECATED) Whether to allow .tar.gz downloading of repo revisions.
373 Default is false.
369 allowpull;;
374 allowpull;;
370 Whether to allow pulling from the repository. Default is true.
375 Whether to allow pulling from the repository. Default is true.
371 allowzip;;
376 allowzip;;
372 Whether to allow .zip downloading of repo revisions. Default is false.
377 (DEPRECATED) Whether to allow .zip downloading of repo revisions.
373 This feature creates temporary files.
378 Default is false. This feature creates temporary files.
374 baseurl;;
379 baseurl;;
375 Base URL to use when publishing URLs in other locations, so
380 Base URL to use when publishing URLs in other locations, so
376 third-party tools like email notification hooks can construct URLs.
381 third-party tools like email notification hooks can construct URLs.
@@ -48,8 +48,9 b' class hgweb(object):'
48 self.allowpull = self.repo.ui.configbool("web", "allowpull", True)
48 self.allowpull = self.repo.ui.configbool("web", "allowpull", True)
49
49
50 def archivelist(self, nodeid):
50 def archivelist(self, nodeid):
51 al = self.repo.ui.config("web", "allow_archive", "").split()
51 for i in self.archives:
52 for i in self.archives:
52 if self.repo.ui.configbool("web", "allow" + i, False):
53 if i in al or self.repo.ui.configbool("web", "allow" + i, False):
53 yield {"type" : i, "node" : nodeid, "url": ""}
54 yield {"type" : i, "node" : nodeid, "url": ""}
54
55
55 def listfiles(self, files, mf):
56 def listfiles(self, files, mf):
@@ -803,8 +804,9 b' class hgweb(object):'
803 elif cmd == 'archive':
804 elif cmd == 'archive':
804 changeset = self.repo.lookup(req.form['node'][0])
805 changeset = self.repo.lookup(req.form['node'][0])
805 type = req.form['type'][0]
806 type = req.form['type'][0]
806 if (type in self.archives and
807 allowed = self.repo.ui.config("web", "allow_archive", "").split()
807 self.repo.ui.configbool("web", "allow" + type, False)):
808 if (type in self.archives and (type in allowed or
809 self.repo.ui.configbool("web", "allow" + type, False))):
808 self.archive(req, changeset, type)
810 self.archive(req, changeset, type)
809 return
811 return
810
812
@@ -58,8 +58,9 b' class hgwebdir(object):'
58 "footer": footer})
58 "footer": footer})
59
59
60 def archivelist(ui, nodeid, url):
60 def archivelist(ui, nodeid, url):
61 al = ui.config("web", "allow_archive", "").split()
61 for i in ['zip', 'gz', 'bz2']:
62 for i in ['zip', 'gz', 'bz2']:
62 if ui.configbool("web", "allow" + i, False):
63 if i in al or ui.configbool("web", "allow" + i, False):
63 yield {"type" : i, "node": nodeid, "url": url}
64 yield {"type" : i, "node": nodeid, "url": url}
64
65
65 def entries(sortcolumn="", descending=False, **map):
66 def entries(sortcolumn="", descending=False, **map):
General Comments 0
You need to be logged in to leave comments. Login now