Mercurial > hg
changeset 30735:9823e2f50a93
hgweb: generate archive links in order
It would be nice for archive links to always be in a certain commonly used
order, such as 'zip', 'bz', 'gzip2'. Repo index page (hgwebdir_mod) already
shows archive links in this order, let's do the same in hgweb_mod.
Sadly, archivespecs is a regular unordered dict, and collections.OrderedDict is
new in 2.7. But requestcontext.archives is a tuple of archive types, so it can
be used as an index to archivespecs.
author | Anton Shestakov <av6@dwimlabs.net> |
---|---|
date | Sun, 08 Jan 2017 00:52:54 +0800 |
parents | b9e49f7b0220 |
children | d9e5b0aeeb90 |
files | mercurial/hgweb/hgweb_mod.py |
diffstat | 1 files changed, 2 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/hgweb/hgweb_mod.py Sun Jan 08 01:24:45 2017 +0800 +++ b/mercurial/hgweb/hgweb_mod.py Sun Jan 08 00:52:54 2017 +0800 @@ -134,7 +134,8 @@ def archivelist(self, nodeid): allowed = self.configlist('web', 'allow_archive') - for typ, spec in self.archivespecs.iteritems(): + for typ in self.archives: + spec = self.archivespecs[typ] if typ in allowed or self.configbool('web', 'allow%s' % typ): yield {'type': typ, 'extension': spec[2], 'node': nodeid}