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