comparison mercurial/hgweb/hgweb_mod.py @ 37512:aac97d043e6d

hgweb: drop archivespecs from requestcontext It's a constant.
author Yuya Nishihara <yuya@tcha.org>
date Sun, 01 Apr 2018 22:33:55 +0900
parents 356e61e82c2a
children 034a422aeaff
comparison
equal deleted inserted replaced
37511:356e61e82c2a 37512:aac97d043e6d
88 self.repo = repo 88 self.repo = repo
89 self.reponame = app.reponame 89 self.reponame = app.reponame
90 self.req = req 90 self.req = req
91 self.res = res 91 self.res = res
92 92
93 self.archivespecs = webutil.archivespecs
94
95 self.maxchanges = self.configint('web', 'maxchanges') 93 self.maxchanges = self.configint('web', 'maxchanges')
96 self.stripecount = self.configint('web', 'stripes') 94 self.stripecount = self.configint('web', 'stripes')
97 self.maxshortchanges = self.configint('web', 'maxshortchanges') 95 self.maxshortchanges = self.configint('web', 'maxshortchanges')
98 self.maxfiles = self.configint('web', 'maxfiles') 96 self.maxfiles = self.configint('web', 'maxfiles')
99 self.allowpull = self.configbool('web', 'allow-pull') 97 self.allowpull = self.configbool('web', 'allow-pull')
129 return self.repo.ui.configlist(section, name, default, 127 return self.repo.ui.configlist(section, name, default,
130 untrusted=untrusted) 128 untrusted=untrusted)
131 129
132 def archivelist(self, nodeid): 130 def archivelist(self, nodeid):
133 allowed = self.configlist('web', 'allow_archive') 131 allowed = self.configlist('web', 'allow_archive')
134 for typ, spec in self.archivespecs.iteritems(): 132 for typ, spec in webutil.archivespecs.iteritems():
135 if typ in allowed or self.configbool('web', 'allow%s' % typ): 133 if typ in allowed or self.configbool('web', 'allow%s' % typ):
136 yield {'type': typ, 'extension': spec[2], 'node': nodeid} 134 yield {'type': typ, 'extension': spec[2], 'node': nodeid}
137 135
138 def templater(self, req): 136 def templater(self, req):
139 # determine scheme, port and server name 137 # determine scheme, port and server name
373 if cmd == 'rev' and 'mercurial' in ua: 371 if cmd == 'rev' and 'mercurial' in ua:
374 req.qsparams['style'] = 'raw' 372 req.qsparams['style'] = 'raw'
375 373
376 if cmd == 'archive': 374 if cmd == 'archive':
377 fn = req.qsparams['node'] 375 fn = req.qsparams['node']
378 for type_, spec in rctx.archivespecs.iteritems(): 376 for type_, spec in webutil.archivespecs.iteritems():
379 ext = spec[2] 377 ext = spec[2]
380 if fn.endswith(ext): 378 if fn.endswith(ext):
381 req.qsparams['node'] = fn[:-len(ext)] 379 req.qsparams['node'] = fn[:-len(ext)]
382 req.qsparams['type'] = type_ 380 req.qsparams['type'] = type_
383 else: 381 else: