1 diff -r 8a4044aacc27 mercurial/hgweb/webcommands.py 2 --- a/mercurial/hgweb/webcommands.py Sun Oct 02 16:41:33 2011 +0200 3 +++ b/mercurial/hgweb/webcommands.py Sun Oct 02 16:42:11 2011 +0200 4 @@ -261,10 +261,10 @@ 5 6 files = [] 7 parity = paritygen(web.stripecount) 8 - for f in ctx.files(): 9 + for blockno, f in enumerate(ctx.files()): 10 template = f in ctx and 'filenodelink' or 'filenolink' 11 files.append(tmpl(template, 12 - node=ctx.hex(), file=f, 13 + node=ctx.hex(), file=f, blockno=blockno+1, 14 parity=parity.next())) 15 16 style = web.config('web', 'style', 'paper') 17 diff -r 8a4044aacc27 mercurial/hgweb/webutil.py 18 --- a/mercurial/hgweb/webutil.py Sun Oct 02 16:41:33 2011 +0200 19 +++ b/mercurial/hgweb/webutil.py Sun Oct 02 16:42:11 2011 +0200 20 @@ -173,8 +173,7 @@ 21 start += 1 22 23 blockcount = countgen() 24 - def prettyprintlines(diff): 25 - blockno = blockcount.next() 26 + def prettyprintlines(diff, blockno): 27 for lineno, l in enumerate(diff.splitlines(True)): 28 lineno = "%d.%d" % (blockno, lineno + 1) 29 if l.startswith('+'): 30 @@ -203,14 +202,16 @@ 31 block = [] 32 for chunk in patch.diff(repo, node1, node2, m, opts=diffopts): 33 if chunk.startswith('diff') and block: 34 - yield tmpl('diffblock', parity=parity.next(), 35 - lines=prettyprintlines(''.join(block))) 36 + blockno = blockcount.next() 37 + yield tmpl('diffblock', parity=parity.next(), blockno=blockno, 38 + lines=prettyprintlines(''.join(block), blockno)) 39 block = [] 40 if chunk.startswith('diff') and style != 'raw': 41 chunk = ''.join(chunk.splitlines(True)[1:]) 42 block.append(chunk) 43 - yield tmpl('diffblock', parity=parity.next(), 44 - lines=prettyprintlines(''.join(block))) 45 + blockno = blockcount.next() 46 + yield tmpl('diffblock', parity=parity.next(), blockno=blockno, 47 + lines=prettyprintlines(''.join(block), blockno)) 48 49 def diffstatgen(ctx): 50 '''Generator function that provides the diffstat data.'''