MercurialWebTheme

Changeset

39:476d910a2c6a
2011-10-02 Paul Boddie raw files shortlog changelog graph Added some patches for hgweb that are required by this theme.
patches/patch-hgweb-webcommands-SVG.diff (file) patches/patch-hgweb-webcommands-blockno.diff (file)
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/patches/patch-hgweb-webcommands-SVG.diff	Sun Oct 02 16:45:50 2011 +0200
     1.3 @@ -0,0 +1,44 @@
     1.4 +diff -r b2d4400398f3 mercurial/hgweb/webcommands.py
     1.5 +--- a/mercurial/hgweb/webcommands.py	Tue Sep 27 18:51:10 2011 +0200
     1.6 ++++ b/mercurial/hgweb/webcommands.py	Sun Oct 02 16:41:16 2011 +0200
     1.7 +@@ -770,6 +770,9 @@
     1.8 +     tree = list(graphmod.colored(dag))
     1.9 +     canvasheight = (len(tree) + 1) * bg_height - 27
    1.10 +     data = []
    1.11 ++    svgdata = []
    1.12 ++    row = 0
    1.13 ++    cols = 0
    1.14 +     for (id, type, ctx, vtx, edges) in tree:
    1.15 +         if type != graphmod.CHANGESET:
    1.16 +             continue
    1.17 +@@ -782,11 +785,29 @@
    1.18 +         branch = branch, web.repo.branchtags().get(branch) == ctx.node()
    1.19 +         data.append((node, vtx, edges, desc, user, age, branch, ctx.tags(),
    1.20 +                      ctx.bookmarks()))
    1.21 ++        svgdata.append(dict(
    1.22 ++            node=node,
    1.23 ++            col=vtx[0],
    1.24 ++            color=(vtx[1] - 1) % 6 + 1,
    1.25 ++            edges=[dict(col=edge[0], nextcol=edge[1], color=(edge[2] - 1) % 6 + 1) for edge in edges],
    1.26 ++            row=row,
    1.27 ++            nextrow=row+1,
    1.28 ++            bg_height=bg_height,
    1.29 ++            desc=desc,
    1.30 ++            user=user,
    1.31 ++            age=age,
    1.32 ++            branches=webutil.nodebranchdict(web.repo, ctx),
    1.33 ++            inbranch=webutil.nodeinbranch(web.repo, ctx),
    1.34 ++            tags=webutil.nodetagsdict(web.repo, ctx.node())))
    1.35 ++        row += 1
    1.36 ++        cols = max(cols, max([edge[0] for edge in edges] or [0]), max([edge[1] for edge in edges] or [0]))
    1.37 + 
    1.38 +     return tmpl('graph', rev=rev, revcount=revcount, uprev=uprev,
    1.39 +                 lessvars=lessvars, morevars=morevars, downrev=downrev,
    1.40 +                 canvasheight=canvasheight, jsdata=data, bg_height=bg_height,
    1.41 +-                node=revnode_hex, changenav=changenav)
    1.42 ++                node=revnode_hex, changenav=changenav, svgdata=svgdata,
    1.43 ++                rows=row, cols=cols, canvaswidth=(cols+1)*bg_height,
    1.44 ++                truecanvasheight=row*bg_height)
    1.45 + 
    1.46 + def _getdoc(e):
    1.47 +     doc = e[0].__doc__
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/patches/patch-hgweb-webcommands-blockno.diff	Sun Oct 02 16:45:50 2011 +0200
     2.3 @@ -0,0 +1,50 @@
     2.4 +diff -r 8a4044aacc27 mercurial/hgweb/webcommands.py
     2.5 +--- a/mercurial/hgweb/webcommands.py	Sun Oct 02 16:41:33 2011 +0200
     2.6 ++++ b/mercurial/hgweb/webcommands.py	Sun Oct 02 16:42:11 2011 +0200
     2.7 +@@ -261,10 +261,10 @@
     2.8 + 
     2.9 +     files = []
    2.10 +     parity = paritygen(web.stripecount)
    2.11 +-    for f in ctx.files():
    2.12 ++    for blockno, f in enumerate(ctx.files()):
    2.13 +         template = f in ctx and 'filenodelink' or 'filenolink'
    2.14 +         files.append(tmpl(template,
    2.15 +-                          node=ctx.hex(), file=f,
    2.16 ++                          node=ctx.hex(), file=f, blockno=blockno+1,
    2.17 +                           parity=parity.next()))
    2.18 + 
    2.19 +     style = web.config('web', 'style', 'paper')
    2.20 +diff -r 8a4044aacc27 mercurial/hgweb/webutil.py
    2.21 +--- a/mercurial/hgweb/webutil.py	Sun Oct 02 16:41:33 2011 +0200
    2.22 ++++ b/mercurial/hgweb/webutil.py	Sun Oct 02 16:42:11 2011 +0200
    2.23 +@@ -173,8 +173,7 @@
    2.24 +             start += 1
    2.25 + 
    2.26 +     blockcount = countgen()
    2.27 +-    def prettyprintlines(diff):
    2.28 +-        blockno = blockcount.next()
    2.29 ++    def prettyprintlines(diff, blockno):
    2.30 +         for lineno, l in enumerate(diff.splitlines(True)):
    2.31 +             lineno = "%d.%d" % (blockno, lineno + 1)
    2.32 +             if l.startswith('+'):
    2.33 +@@ -203,14 +202,16 @@
    2.34 +     block = []
    2.35 +     for chunk in patch.diff(repo, node1, node2, m, opts=diffopts):
    2.36 +         if chunk.startswith('diff') and block:
    2.37 +-            yield tmpl('diffblock', parity=parity.next(),
    2.38 +-                       lines=prettyprintlines(''.join(block)))
    2.39 ++            blockno = blockcount.next()
    2.40 ++            yield tmpl('diffblock', parity=parity.next(), blockno=blockno,
    2.41 ++                       lines=prettyprintlines(''.join(block), blockno))
    2.42 +             block = []
    2.43 +         if chunk.startswith('diff') and style != 'raw':
    2.44 +             chunk = ''.join(chunk.splitlines(True)[1:])
    2.45 +         block.append(chunk)
    2.46 +-    yield tmpl('diffblock', parity=parity.next(),
    2.47 +-               lines=prettyprintlines(''.join(block)))
    2.48 ++    blockno = blockcount.next()
    2.49 ++    yield tmpl('diffblock', parity=parity.next(), blockno=blockno,
    2.50 ++               lines=prettyprintlines(''.join(block), blockno))
    2.51 + 
    2.52 + def diffstatgen(ctx):
    2.53 +     '''Generator function that provides the diffstat data.'''