comparison mercurial/hgweb/webcommands.py @ 16308:2695aaf4eb72

hgweb: add block numbers to diff regions and related links The changeset view may show several diff regions, one per file, and this patch numbers each of them so that links produced by the filenodelink fragment can reference each diff region produced by the diffblock fragment through the use of the blockno variable made available to both of them. This permits navigation to diff regions on the changeset page from the file list, and where the :target pseudo-class is supported in browsers, permits selective presentation of diffs, showing one at a time instead of potentially many in what would otherwise be a very long page that is difficult to navigate.
author Paul Boddie <paul@boddie.org.uk>
date Fri, 23 Mar 2012 01:31:31 +0100
parents 5e50982c633c
children e6b45e9a75dc
comparison
equal deleted inserted replaced
16307:17a9a1f5cee2 16308:2695aaf4eb72
260 ctx.node()) 260 ctx.node())
261 showbranch = webutil.nodebranchnodefault(ctx) 261 showbranch = webutil.nodebranchnodefault(ctx)
262 262
263 files = [] 263 files = []
264 parity = paritygen(web.stripecount) 264 parity = paritygen(web.stripecount)
265 for f in ctx.files(): 265 for blockno, f in enumerate(ctx.files()):
266 template = f in ctx and 'filenodelink' or 'filenolink' 266 template = f in ctx and 'filenodelink' or 'filenolink'
267 files.append(tmpl(template, 267 files.append(tmpl(template,
268 node=ctx.hex(), file=f, 268 node=ctx.hex(), file=f, blockno=blockno + 1,
269 parity=parity.next())) 269 parity=parity.next()))
270 270
271 style = web.config('web', 'style', 'paper') 271 style = web.config('web', 'style', 'paper')
272 if 'style' in req.form: 272 if 'style' in req.form:
273 style = req.form['style'][0] 273 style = req.form['style'][0]