comparison mercurial/hgweb/webcommands.py @ 36869:1a1972b1a1ff

hgweb: use our new request object for "style" parameter The "style" parameter is kind of wonky because it is explicitly set and has lookups in random locations. Let's port it to qsparams first because it isn't straightforward. There is subtle change in behavior. But I don't think it is worth calling out in a BC. Our multidict's __getitem__ returns the last set value for a key, not the first. So if the query string set a variable multiple times, before we would get the first value and now we would get the last value. It makes no sense to specify these things multiple times. And I think last write wins is more sensible than first write wins. Differential Revision: https://phab.mercurial-scm.org/D2779
author Gregory Szorc <gregory.szorc@gmail.com>
date Sat, 10 Mar 2018 11:46:52 -0800
parents 250f3168d907
children 3d60a22e27f5
comparison
equal deleted inserted replaced
36868:ec0af9c59270 36869:1a1972b1a1ff
760 path = fctx.path() 760 path = fctx.path()
761 ctx = fctx.changectx() 761 ctx = fctx.changectx()
762 basectx = ctx.p1() 762 basectx = ctx.p1()
763 763
764 style = web.config('web', 'style') 764 style = web.config('web', 'style')
765 if 'style' in req.form: 765 if 'style' in req.req.qsparams:
766 style = req.form['style'][0] 766 style = req.req.qsparams['style']
767 767
768 diffs = webutil.diffs(web, tmpl, ctx, basectx, [path], style) 768 diffs = webutil.diffs(web, tmpl, ctx, basectx, [path], style)
769 if fctx is not None: 769 if fctx is not None:
770 rename = webutil.renamelink(fctx) 770 rename = webutil.renamelink(fctx)
771 ctx = fctx 771 ctx = fctx
1009 repo = web.repo 1009 repo = web.repo
1010 revs = fctx.filelog().revs(start, end - 1) 1010 revs = fctx.filelog().revs(start, end - 1)
1011 entries = [] 1011 entries = []
1012 1012
1013 diffstyle = web.config('web', 'style') 1013 diffstyle = web.config('web', 'style')
1014 if 'style' in req.form: 1014 if 'style' in req.req.qsparams:
1015 diffstyle = req.form['style'][0] 1015 diffstyle = req.req.qsparams['style']
1016 1016
1017 def diff(fctx, linerange=None): 1017 def diff(fctx, linerange=None):
1018 ctx = fctx.changectx() 1018 ctx = fctx.changectx()
1019 basectx = ctx.p1() 1019 basectx = ctx.p1()
1020 path = fctx.path() 1020 path = fctx.path()