[PATCH 7 of 8] hgweb: forward archivelist() of hgweb to webutil

Yuya Nishihara yuya at tcha.org
Tue Apr 10 11:41:40 EDT 2018


# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1522590015 -32400
#      Sun Apr 01 22:40:15 2018 +0900
# Node ID d9f6292315ef2e0000e355cccc3a6dc10c20eefd
# Parent  f698f65fbaf88305353eb769e0130299fc747f08
hgweb: forward archivelist() of hgweb to webutil

self.configlist() is ui.configlist(untrusted=True), and url=None in templater
effectively means 'url' is undefined.

diff --git a/mercurial/hgweb/hgweb_mod.py b/mercurial/hgweb/hgweb_mod.py
--- a/mercurial/hgweb/hgweb_mod.py
+++ b/mercurial/hgweb/hgweb_mod.py
@@ -128,10 +128,7 @@ class requestcontext(object):
                                        untrusted=untrusted)
 
     def archivelist(self, nodeid):
-        allowed = self.configlist('web', 'allow_archive')
-        for typ, spec in webutil.archivespecs.iteritems():
-            if typ in allowed or self.configbool('web', 'allow%s' % typ):
-                yield {'type': typ, 'extension': spec[2], 'node': nodeid}
+        return webutil.archivelist(self.repo.ui, nodeid)
 
     def templater(self, req):
         # determine scheme, port and server name
diff --git a/mercurial/hgweb/webutil.py b/mercurial/hgweb/webutil.py
--- a/mercurial/hgweb/webutil.py
+++ b/mercurial/hgweb/webutil.py
@@ -49,7 +49,7 @@ archivespecs = util.sortdict((
     ('bz2', ('application/x-bzip2', 'tbz2', '.tar.bz2', None)),
 ))
 
-def archivelist(ui, nodeid, url):
+def archivelist(ui, nodeid, url=None):
     allowed = ui.configlist('web', 'allow_archive', untrusted=True)
     archives = []
 


More information about the Mercurial-devel mailing list