1.1 --- a/patches/patch-hgweb-webcommands-blockno.diff Fri Dec 02 00:26:18 2011 +0100
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,57 +0,0 @@
1.4 -# HG changeset patch
1.5 -# User Paul Boddie <paul@boddie.org.uk>
1.6 -# Date 1322607647 -3600
1.7 -# Node ID 387585e3105efc9df33e947527950ced65320201
1.8 -# Parent ad686c818e1c7d5ed0335327321003ba8ea04664
1.9 -hgweb: Introduce a blockno variable in the changeset's files list and in the diffs webcommand
1.10 -
1.11 -diff -r ad686c818e1c -r 387585e3105e mercurial/hgweb/webcommands.py
1.12 ---- a/mercurial/hgweb/webcommands.py Fri Nov 25 02:11:12 2011 +0100
1.13 -+++ b/mercurial/hgweb/webcommands.py Wed Nov 30 00:00:47 2011 +0100
1.14 -@@ -261,10 +261,10 @@
1.15 -
1.16 - files = []
1.17 - parity = paritygen(web.stripecount)
1.18 -- for f in ctx.files():
1.19 -+ for blockno, f in enumerate(ctx.files()):
1.20 - template = f in ctx and 'filenodelink' or 'filenolink'
1.21 - files.append(tmpl(template,
1.22 -- node=ctx.hex(), file=f,
1.23 -+ node=ctx.hex(), file=f, blockno=blockno+1,
1.24 - parity=parity.next()))
1.25 -
1.26 - style = web.config('web', 'style', 'paper')
1.27 -diff -r ad686c818e1c -r 387585e3105e mercurial/hgweb/webutil.py
1.28 ---- a/mercurial/hgweb/webutil.py Fri Nov 25 02:11:12 2011 +0100
1.29 -+++ b/mercurial/hgweb/webutil.py Wed Nov 30 00:00:47 2011 +0100
1.30 -@@ -173,8 +173,7 @@
1.31 - start += 1
1.32 -
1.33 - blockcount = countgen()
1.34 -- def prettyprintlines(diff):
1.35 -- blockno = blockcount.next()
1.36 -+ def prettyprintlines(diff, blockno):
1.37 - for lineno, l in enumerate(diff.splitlines(True)):
1.38 - lineno = "%d.%d" % (blockno, lineno + 1)
1.39 - if l.startswith('+'):
1.40 -@@ -203,14 +202,16 @@
1.41 - block = []
1.42 - for chunk in patch.diff(repo, node1, node2, m, opts=diffopts):
1.43 - if chunk.startswith('diff') and block:
1.44 -- yield tmpl('diffblock', parity=parity.next(),
1.45 -- lines=prettyprintlines(''.join(block)))
1.46 -+ blockno = blockcount.next()
1.47 -+ yield tmpl('diffblock', parity=parity.next(), blockno=blockno,
1.48 -+ lines=prettyprintlines(''.join(block), blockno))
1.49 - block = []
1.50 - if chunk.startswith('diff') and style != 'raw':
1.51 - chunk = ''.join(chunk.splitlines(True)[1:])
1.52 - block.append(chunk)
1.53 -- yield tmpl('diffblock', parity=parity.next(),
1.54 -- lines=prettyprintlines(''.join(block)))
1.55 -+ blockno = blockcount.next()
1.56 -+ yield tmpl('diffblock', parity=parity.next(), blockno=blockno,
1.57 -+ lines=prettyprintlines(''.join(block), blockno))
1.58 -
1.59 - def diffstatgen(ctx):
1.60 - '''Generator function that provides the diffstat data.'''