# HG changeset patch # User Paul Boddie # Date 1337552877 -7200 # Node ID 8f793190f1a69eb431b7d038f54a89f8cc16e6f8 # Parent 38afdf6585ee819fb5f3a82821067f60fb76d637 Updated the patch; included missing raw theme files. diff -r 38afdf6585ee -r 8f793190f1a6 patches/patch-hgweb-graph-data.diff --- a/patches/patch-hgweb-graph-data.diff Sun May 20 18:39:14 2012 +0200 +++ b/patches/patch-hgweb-graph-data.diff Mon May 21 00:27:57 2012 +0200 @@ -1,8 +1,8 @@ # HG changeset patch # User Paul Boddie -# Date 1337531723 -7200 -# Node ID 9488fd4c05876377ad4e3b2ca4c60713d20bf917 -# Parent d7c9976b930e1fdbf8608a65462cd124977c7d53 +# Date 1337552405 -7200 +# Node ID 6bf09cdbff531a07c2ccce0ee63baca33955608a +# Parent 99f369f5a8dbc192cd520aece8437f3182b1ac50 hgweb: make graph data suitable for template usage Previously, graph data has been encoded for processing done by @@ -20,10 +20,10 @@ makes use of a much simpler output representation than SVG in order to maintain clarity. -diff -r d7c9976b930e -r 9488fd4c0587 mercurial/hgweb/webcommands.py ---- a/mercurial/hgweb/webcommands.py Wed May 02 13:20:06 2012 +0200 -+++ b/mercurial/hgweb/webcommands.py Sun May 20 18:35:23 2012 +0200 -@@ -783,24 +783,69 @@ +diff -r 99f369f5a8db -r 6bf09cdbff53 mercurial/hgweb/webcommands.py +--- a/mercurial/hgweb/webcommands.py Tue May 15 07:01:35 2012 +0200 ++++ b/mercurial/hgweb/webcommands.py Mon May 21 00:20:05 2012 +0200 +@@ -784,28 +784,73 @@ dag = graphmod.dagwalker(web.repo, range(startrev, downrev - 1, -1)) tree = list(graphmod.colored(dag, web.repo)) @@ -38,10 +38,14 @@ - desc = cgi.escape(templatefilters.nonempty(desc)) - user = cgi.escape(templatefilters.person(ctx.user())) - branch = ctx.branch() -- branch = branch, web.repo.branchtags().get(branch) == ctx.node() +- try: +- branchnode = web.repo.branchtip(branch) +- except error.RepoLookupError: +- branchnode = None +- branch = branch, branchnode == ctx.node() - data.append((node, vtx, edges, desc, user, age, branch, ctx.tags(), - ctx.bookmarks())) -+ + + def getcolumns(tree): + cols = 0 + for (id, type, ctx, vtx, edges) in tree: @@ -50,10 +54,10 @@ + cols = max(cols, max([edge[0] for edge in edges] or [0]), + max([edge[1] for edge in edges] or [0])) + return cols -+ ++ + def graphdata(usetuples, **map): + data = [] -+ ++ + row = 0 + for (id, type, ctx, vtx, edges) in tree: + if type != graphmod.CHANGESET: @@ -64,7 +68,11 @@ + desc = cgi.escape(templatefilters.nonempty(desc)) + user = cgi.escape(templatefilters.person(ctx.user())) + branch = ctx.branch() -+ branch = branch, web.repo.branchtags().get(branch) == ctx.node() ++ try: ++ branchnode = web.repo.branchtip(branch) ++ except error.RepoLookupError: ++ branchnode = None ++ branch = branch, branchnode == ctx.node() + + if usetuples: + data.append((node, vtx, edges, desc, user, age, branch, ctx.tags(), @@ -73,7 +81,7 @@ + edgedata = [dict(col=edge[0], nextcol=edge[1], + color=(edge[2] - 1) % 6 + 1, + width=edge[3], bcolor=edge[4]) for edge in edges] -+ ++ + data.append(dict(node=node, + col=vtx[0], + color=(vtx[1] - 1) % 6 + 1, @@ -87,15 +95,15 @@ + branches=webutil.nodebranchdict(web.repo, ctx), + inbranch=webutil.nodeinbranch(web.repo, ctx), + tags=webutil.nodetagsdict(web.repo, ctx.node()))) -+ ++ + row += 1 -+ ++ + return data + + cols = getcolumns(tree) + rows = len(tree) + canvasheight = (rows + 1) * bg_height - 27 - ++ return tmpl('graph', rev=rev, revcount=revcount, uprev=uprev, lessvars=lessvars, morevars=morevars, downrev=downrev, - canvasheight=canvasheight, jsdata=data, bg_height=bg_height, @@ -108,9 +116,35 @@ node=revnode_hex, changenav=changenav) def _getdoc(e): -diff -r d7c9976b930e -r 9488fd4c0587 mercurial/templates/raw/map ---- a/mercurial/templates/raw/map Wed May 02 13:20:06 2012 +0200 -+++ b/mercurial/templates/raw/map Sun May 20 18:35:23 2012 +0200 +diff -r 99f369f5a8db -r 6bf09cdbff53 mercurial/templates/raw/graph.tmpl +--- /dev/null Thu Jan 01 00:00:00 1970 +0000 ++++ b/mercurial/templates/raw/graph.tmpl Mon May 21 00:20:05 2012 +0200 +@@ -0,0 +1,6 @@ ++{header} ++# HG graph ++# Node ID {node} ++# Rows shown {rows} ++ ++{nodes%graphnode} +diff -r 99f369f5a8db -r 6bf09cdbff53 mercurial/templates/raw/graphedge.tmpl +--- /dev/null Thu Jan 01 00:00:00 1970 +0000 ++++ b/mercurial/templates/raw/graphedge.tmpl Mon May 21 00:20:05 2012 +0200 +@@ -0,0 +1,1 @@ ++edge: ({col}, {row}) -> ({nextcol}, {nextrow}) (color {color}) +diff -r 99f369f5a8db -r 6bf09cdbff53 mercurial/templates/raw/graphnode.tmpl +--- /dev/null Thu Jan 01 00:00:00 1970 +0000 ++++ b/mercurial/templates/raw/graphnode.tmpl Mon May 21 00:20:05 2012 +0200 +@@ -0,0 +1,7 @@ ++changeset: {node} ++user: {user} ++date: {age} ++summary: {desc} ++{branches%branchname}{tags%tagname}{bookmarks%bookmarkname} ++node: ({col}, {row}) (color {color}) ++{edges%graphedge} +diff -r 99f369f5a8db -r 6bf09cdbff53 mercurial/templates/raw/map +--- a/mercurial/templates/raw/map Tue May 15 07:01:35 2012 +0200 ++++ b/mercurial/templates/raw/map Mon May 21 00:20:05 2012 +0200 @@ -28,3 +28,9 @@ bookmarkentry = '{bookmark} {node}\n' branches = '{entries%branchentry}' @@ -121,10 +155,10 @@ +bookmarkname = 'bookmark: {name}\n' +branchname = 'branch: {name}\n' +tagname = 'tag: {name}\n' -diff -r d7c9976b930e -r 9488fd4c0587 tests/test-hgweb-commands.t ---- a/tests/test-hgweb-commands.t Wed May 02 13:20:06 2012 +0200 -+++ b/tests/test-hgweb-commands.t Sun May 20 18:35:23 2012 +0200 -@@ -1038,6 +1038,55 @@ +diff -r 99f369f5a8db -r 6bf09cdbff53 tests/test-hgweb-commands.t +--- a/tests/test-hgweb-commands.t Tue May 15 07:01:35 2012 +0200 ++++ b/tests/test-hgweb-commands.t Mon May 21 00:20:05 2012 +0200 +@@ -1047,6 +1047,55 @@