1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/patches/patch-hgweb-webcommands-blockno.diff Sun Oct 02 16:45:50 2011 +0200
1.3 @@ -0,0 +1,50 @@
1.4 +diff -r 8a4044aacc27 mercurial/hgweb/webcommands.py
1.5 +--- a/mercurial/hgweb/webcommands.py Sun Oct 02 16:41:33 2011 +0200
1.6 ++++ b/mercurial/hgweb/webcommands.py Sun Oct 02 16:42:11 2011 +0200
1.7 +@@ -261,10 +261,10 @@
1.8 +
1.9 + files = []
1.10 + parity = paritygen(web.stripecount)
1.11 +- for f in ctx.files():
1.12 ++ for blockno, f in enumerate(ctx.files()):
1.13 + template = f in ctx and 'filenodelink' or 'filenolink'
1.14 + files.append(tmpl(template,
1.15 +- node=ctx.hex(), file=f,
1.16 ++ node=ctx.hex(), file=f, blockno=blockno+1,
1.17 + parity=parity.next()))
1.18 +
1.19 + style = web.config('web', 'style', 'paper')
1.20 +diff -r 8a4044aacc27 mercurial/hgweb/webutil.py
1.21 +--- a/mercurial/hgweb/webutil.py Sun Oct 02 16:41:33 2011 +0200
1.22 ++++ b/mercurial/hgweb/webutil.py Sun Oct 02 16:42:11 2011 +0200
1.23 +@@ -173,8 +173,7 @@
1.24 + start += 1
1.25 +
1.26 + blockcount = countgen()
1.27 +- def prettyprintlines(diff):
1.28 +- blockno = blockcount.next()
1.29 ++ def prettyprintlines(diff, blockno):
1.30 + for lineno, l in enumerate(diff.splitlines(True)):
1.31 + lineno = "%d.%d" % (blockno, lineno + 1)
1.32 + if l.startswith('+'):
1.33 +@@ -203,14 +202,16 @@
1.34 + block = []
1.35 + for chunk in patch.diff(repo, node1, node2, m, opts=diffopts):
1.36 + if chunk.startswith('diff') and block:
1.37 +- yield tmpl('diffblock', parity=parity.next(),
1.38 +- lines=prettyprintlines(''.join(block)))
1.39 ++ blockno = blockcount.next()
1.40 ++ yield tmpl('diffblock', parity=parity.next(), blockno=blockno,
1.41 ++ lines=prettyprintlines(''.join(block), blockno))
1.42 + block = []
1.43 + if chunk.startswith('diff') and style != 'raw':
1.44 + chunk = ''.join(chunk.splitlines(True)[1:])
1.45 + block.append(chunk)
1.46 +- yield tmpl('diffblock', parity=parity.next(),
1.47 +- lines=prettyprintlines(''.join(block)))
1.48 ++ blockno = blockcount.next()
1.49 ++ yield tmpl('diffblock', parity=parity.next(), blockno=blockno,
1.50 ++ lines=prettyprintlines(''.join(block), blockno))
1.51 +
1.52 + def diffstatgen(ctx):
1.53 + '''Generator function that provides the diffstat data.'''