comparison mercurial/hgweb/hgweb_mod.py @ 2358:8819fc1dcf4b

hgweb: add allow_archive support to [web] section of hgrc
author TK Soh <teekaysoh@yahoo.com>
date Thu, 01 Jun 2006 10:02:24 -0500
parents 2db831b33e8f
children a392eaa81f29
comparison
equal deleted inserted replaced
2357:4a7bdb1e8dc1 2358:8819fc1dcf4b
46 self.maxchanges = int(self.repo.ui.config("web", "maxchanges", 10)) 46 self.maxchanges = int(self.repo.ui.config("web", "maxchanges", 10))
47 self.maxfiles = int(self.repo.ui.config("web", "maxfiles", 10)) 47 self.maxfiles = int(self.repo.ui.config("web", "maxfiles", 10))
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):
56 for f in files[:self.maxfiles]: 57 for f in files[:self.maxfiles]:
57 yield self.t("filenodelink", node=hex(mf[f]), file=f) 58 yield self.t("filenodelink", node=hex(mf[f]), file=f)
801 req.write(z.flush()) 802 req.write(z.flush())
802 803
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
811 req.write(self.t("error")) 813 req.write(self.t("error"))
812 814