Mercurial > public > mercurial-scm > hg
comparison mercurial/hgweb/webcommands.py @ 20095:1c46b18b0e1c
merge with stable
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Fri, 22 Nov 2013 17:26:58 -0600 |
parents | 2771e59afac4 77acd8ce01ce |
children | 7d40e706412c |
comparison
equal
deleted
inserted
replaced
20091:abfe6a8e619b | 20095:1c46b18b0e1c |
---|---|
226 break | 226 break |
227 | 227 |
228 query = req.form['rev'][0] | 228 query = req.form['rev'][0] |
229 revcount = web.maxchanges | 229 revcount = web.maxchanges |
230 if 'revcount' in req.form: | 230 if 'revcount' in req.form: |
231 revcount = int(req.form.get('revcount', [revcount])[0]) | 231 try: |
232 revcount = max(revcount, 1) | 232 revcount = int(req.form.get('revcount', [revcount])[0]) |
233 tmpl.defaults['sessionvars']['revcount'] = revcount | 233 revcount = max(revcount, 1) |
234 tmpl.defaults['sessionvars']['revcount'] = revcount | |
235 except ValueError: | |
236 pass | |
234 | 237 |
235 lessvars = copy.copy(tmpl.defaults['sessionvars']) | 238 lessvars = copy.copy(tmpl.defaults['sessionvars']) |
236 lessvars['revcount'] = max(revcount / 2, 1) | 239 lessvars['revcount'] = max(revcount / 2, 1) |
237 lessvars['rev'] = query | 240 lessvars['rev'] = query |
238 morevars = copy.copy(tmpl.defaults['sessionvars']) | 241 morevars = copy.copy(tmpl.defaults['sessionvars']) |
305 "branches": webutil.nodebranchdict(web.repo, ctx) | 308 "branches": webutil.nodebranchdict(web.repo, ctx) |
306 } | 309 } |
307 | 310 |
308 revcount = shortlog and web.maxshortchanges or web.maxchanges | 311 revcount = shortlog and web.maxshortchanges or web.maxchanges |
309 if 'revcount' in req.form: | 312 if 'revcount' in req.form: |
310 revcount = int(req.form.get('revcount', [revcount])[0]) | 313 try: |
311 revcount = max(revcount, 1) | 314 revcount = int(req.form.get('revcount', [revcount])[0]) |
312 tmpl.defaults['sessionvars']['revcount'] = revcount | 315 revcount = max(revcount, 1) |
316 tmpl.defaults['sessionvars']['revcount'] = revcount | |
317 except ValueError: | |
318 pass | |
313 | 319 |
314 lessvars = copy.copy(tmpl.defaults['sessionvars']) | 320 lessvars = copy.copy(tmpl.defaults['sessionvars']) |
315 lessvars['revcount'] = max(revcount / 2, 1) | 321 lessvars['revcount'] = max(revcount / 2, 1) |
316 morevars = copy.copy(tmpl.defaults['sessionvars']) | 322 morevars = copy.copy(tmpl.defaults['sessionvars']) |
317 morevars['revcount'] = revcount * 2 | 323 morevars['revcount'] = revcount * 2 |
820 frev -= 1 | 826 frev -= 1 |
821 fctx = web.repo.filectx(f, fl.linkrev(frev)) | 827 fctx = web.repo.filectx(f, fl.linkrev(frev)) |
822 | 828 |
823 revcount = web.maxshortchanges | 829 revcount = web.maxshortchanges |
824 if 'revcount' in req.form: | 830 if 'revcount' in req.form: |
825 revcount = int(req.form.get('revcount', [revcount])[0]) | 831 try: |
826 revcount = max(revcount, 1) | 832 revcount = int(req.form.get('revcount', [revcount])[0]) |
827 tmpl.defaults['sessionvars']['revcount'] = revcount | 833 revcount = max(revcount, 1) |
834 tmpl.defaults['sessionvars']['revcount'] = revcount | |
835 except ValueError: | |
836 pass | |
828 | 837 |
829 lessvars = copy.copy(tmpl.defaults['sessionvars']) | 838 lessvars = copy.copy(tmpl.defaults['sessionvars']) |
830 lessvars['revcount'] = max(revcount / 2, 1) | 839 lessvars['revcount'] = max(revcount / 2, 1) |
831 morevars = copy.copy(tmpl.defaults['sessionvars']) | 840 morevars = copy.copy(tmpl.defaults['sessionvars']) |
832 morevars['revcount'] = revcount * 2 | 841 morevars['revcount'] = revcount * 2 |
942 rev = ctx.rev() | 951 rev = ctx.rev() |
943 | 952 |
944 bg_height = 39 | 953 bg_height = 39 |
945 revcount = web.maxshortchanges | 954 revcount = web.maxshortchanges |
946 if 'revcount' in req.form: | 955 if 'revcount' in req.form: |
947 revcount = int(req.form.get('revcount', [revcount])[0]) | 956 try: |
948 revcount = max(revcount, 1) | 957 revcount = int(req.form.get('revcount', [revcount])[0]) |
949 tmpl.defaults['sessionvars']['revcount'] = revcount | 958 revcount = max(revcount, 1) |
959 tmpl.defaults['sessionvars']['revcount'] = revcount | |
960 except ValueError: | |
961 pass | |
950 | 962 |
951 lessvars = copy.copy(tmpl.defaults['sessionvars']) | 963 lessvars = copy.copy(tmpl.defaults['sessionvars']) |
952 lessvars['revcount'] = max(revcount / 2, 1) | 964 lessvars['revcount'] = max(revcount / 2, 1) |
953 morevars = copy.copy(tmpl.defaults['sessionvars']) | 965 morevars = copy.copy(tmpl.defaults['sessionvars']) |
954 morevars['revcount'] = revcount * 2 | 966 morevars['revcount'] = revcount * 2 |