mercurial/hgweb/hgweb_mod.py
changeset 30748 319914d57b9e
parent 30735 9823e2f50a93
child 30749 e38e7ea21987
--- a/mercurial/hgweb/hgweb_mod.py	Wed Jan 11 01:25:07 2017 +0800
+++ b/mercurial/hgweb/hgweb_mod.py	Tue Jan 10 23:34:39 2017 +0800
@@ -89,8 +89,6 @@
         self.repo = repo
         self.reponame = app.reponame
 
-        self.archives = ('zip', 'gz', 'bz2')
-
         self.maxchanges = self.configint('web', 'maxchanges', 10)
         self.stripecount = self.configint('web', 'stripes', 1)
         self.maxshortchanges = self.configint('web', 'maxshortchanges', 60)
@@ -126,16 +124,15 @@
         return self.repo.ui.configlist(section, name, default,
                                        untrusted=untrusted)
 
-    archivespecs = {
-        'bz2': ('application/x-bzip2', 'tbz2', '.tar.bz2', None),
-        'gz': ('application/x-gzip', 'tgz', '.tar.gz', None),
-        'zip': ('application/zip', 'zip', '.zip', None),
-    }
+    archivespecs = util.sortdict((
+        ('zip', ('application/zip', 'zip', '.zip', None)),
+        ('gz', ('application/x-gzip', 'tgz', '.tar.gz', None)),
+        ('bz2', ('application/x-bzip2', 'tbz2', '.tar.bz2', None)),
+    ))
 
     def archivelist(self, nodeid):
         allowed = self.configlist('web', 'allow_archive')
-        for typ in self.archives:
-            spec = self.archivespecs[typ]
+        for typ, spec in self.archivespecs.iteritems():
             if typ in allowed or self.configbool('web', 'allow%s' % typ):
                 yield {'type': typ, 'extension': spec[2], 'node': nodeid}