mercurial/hgweb/webutil.py
changeset 37513 40a7c1dd2df9
parent 37511 356e61e82c2a
child 37514 034a422aeaff
--- a/mercurial/hgweb/webutil.py	Sun Apr 01 22:33:55 2018 +0900
+++ b/mercurial/hgweb/webutil.py	Sun Apr 01 22:37:03 2018 +0900
@@ -49,6 +49,22 @@
     ('bz2', ('application/x-bzip2', 'tbz2', '.tar.bz2', None)),
 ))
 
+def archivelist(ui, nodeid, url):
+    allowed = ui.configlist('web', 'allow_archive', untrusted=True)
+    archives = []
+
+    for typ, spec in archivespecs.iteritems():
+        if typ in allowed or ui.configbool('web', 'allow' + typ,
+                                           untrusted=True):
+            archives.append({
+                'type': typ,
+                'extension': spec[2],
+                'node': nodeid,
+                'url': url,
+            })
+
+    return archives
+
 def up(p):
     if p[0:1] != "/":
         p = "/" + p