1.1 --- a/patches/patch-hgweb-graph-data.diff Sun May 20 18:39:14 2012 +0200
1.2 +++ b/patches/patch-hgweb-graph-data.diff Mon May 21 00:27:57 2012 +0200
1.3 @@ -1,8 +1,8 @@
1.4 # HG changeset patch
1.5 # User Paul Boddie <paul@boddie.org.uk>
1.6 -# Date 1337531723 -7200
1.7 -# Node ID 9488fd4c05876377ad4e3b2ca4c60713d20bf917
1.8 -# Parent d7c9976b930e1fdbf8608a65462cd124977c7d53
1.9 +# Date 1337552405 -7200
1.10 +# Node ID 6bf09cdbff531a07c2ccce0ee63baca33955608a
1.11 +# Parent 99f369f5a8dbc192cd520aece8437f3182b1ac50
1.12 hgweb: make graph data suitable for template usage
1.13
1.14 Previously, graph data has been encoded for processing done by
1.15 @@ -20,10 +20,10 @@
1.16 makes use of a much simpler output representation than SVG in
1.17 order to maintain clarity.
1.18
1.19 -diff -r d7c9976b930e -r 9488fd4c0587 mercurial/hgweb/webcommands.py
1.20 ---- a/mercurial/hgweb/webcommands.py Wed May 02 13:20:06 2012 +0200
1.21 -+++ b/mercurial/hgweb/webcommands.py Sun May 20 18:35:23 2012 +0200
1.22 -@@ -783,24 +783,69 @@
1.23 +diff -r 99f369f5a8db -r 6bf09cdbff53 mercurial/hgweb/webcommands.py
1.24 +--- a/mercurial/hgweb/webcommands.py Tue May 15 07:01:35 2012 +0200
1.25 ++++ b/mercurial/hgweb/webcommands.py Mon May 21 00:20:05 2012 +0200
1.26 +@@ -784,28 +784,73 @@
1.27
1.28 dag = graphmod.dagwalker(web.repo, range(startrev, downrev - 1, -1))
1.29 tree = list(graphmod.colored(dag, web.repo))
1.30 @@ -38,10 +38,14 @@
1.31 - desc = cgi.escape(templatefilters.nonempty(desc))
1.32 - user = cgi.escape(templatefilters.person(ctx.user()))
1.33 - branch = ctx.branch()
1.34 -- branch = branch, web.repo.branchtags().get(branch) == ctx.node()
1.35 +- try:
1.36 +- branchnode = web.repo.branchtip(branch)
1.37 +- except error.RepoLookupError:
1.38 +- branchnode = None
1.39 +- branch = branch, branchnode == ctx.node()
1.40 - data.append((node, vtx, edges, desc, user, age, branch, ctx.tags(),
1.41 - ctx.bookmarks()))
1.42 -+
1.43 +
1.44 + def getcolumns(tree):
1.45 + cols = 0
1.46 + for (id, type, ctx, vtx, edges) in tree:
1.47 @@ -50,10 +54,10 @@
1.48 + cols = max(cols, max([edge[0] for edge in edges] or [0]),
1.49 + max([edge[1] for edge in edges] or [0]))
1.50 + return cols
1.51 -+
1.52 ++
1.53 + def graphdata(usetuples, **map):
1.54 + data = []
1.55 -+
1.56 ++
1.57 + row = 0
1.58 + for (id, type, ctx, vtx, edges) in tree:
1.59 + if type != graphmod.CHANGESET:
1.60 @@ -64,7 +68,11 @@
1.61 + desc = cgi.escape(templatefilters.nonempty(desc))
1.62 + user = cgi.escape(templatefilters.person(ctx.user()))
1.63 + branch = ctx.branch()
1.64 -+ branch = branch, web.repo.branchtags().get(branch) == ctx.node()
1.65 ++ try:
1.66 ++ branchnode = web.repo.branchtip(branch)
1.67 ++ except error.RepoLookupError:
1.68 ++ branchnode = None
1.69 ++ branch = branch, branchnode == ctx.node()
1.70 +
1.71 + if usetuples:
1.72 + data.append((node, vtx, edges, desc, user, age, branch, ctx.tags(),
1.73 @@ -73,7 +81,7 @@
1.74 + edgedata = [dict(col=edge[0], nextcol=edge[1],
1.75 + color=(edge[2] - 1) % 6 + 1,
1.76 + width=edge[3], bcolor=edge[4]) for edge in edges]
1.77 -+
1.78 ++
1.79 + data.append(dict(node=node,
1.80 + col=vtx[0],
1.81 + color=(vtx[1] - 1) % 6 + 1,
1.82 @@ -87,15 +95,15 @@
1.83 + branches=webutil.nodebranchdict(web.repo, ctx),
1.84 + inbranch=webutil.nodeinbranch(web.repo, ctx),
1.85 + tags=webutil.nodetagsdict(web.repo, ctx.node())))
1.86 -+
1.87 ++
1.88 + row += 1
1.89 -+
1.90 ++
1.91 + return data
1.92 +
1.93 + cols = getcolumns(tree)
1.94 + rows = len(tree)
1.95 + canvasheight = (rows + 1) * bg_height - 27
1.96 -
1.97 ++
1.98 return tmpl('graph', rev=rev, revcount=revcount, uprev=uprev,
1.99 lessvars=lessvars, morevars=morevars, downrev=downrev,
1.100 - canvasheight=canvasheight, jsdata=data, bg_height=bg_height,
1.101 @@ -108,9 +116,35 @@
1.102 node=revnode_hex, changenav=changenav)
1.103
1.104 def _getdoc(e):
1.105 -diff -r d7c9976b930e -r 9488fd4c0587 mercurial/templates/raw/map
1.106 ---- a/mercurial/templates/raw/map Wed May 02 13:20:06 2012 +0200
1.107 -+++ b/mercurial/templates/raw/map Sun May 20 18:35:23 2012 +0200
1.108 +diff -r 99f369f5a8db -r 6bf09cdbff53 mercurial/templates/raw/graph.tmpl
1.109 +--- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.110 ++++ b/mercurial/templates/raw/graph.tmpl Mon May 21 00:20:05 2012 +0200
1.111 +@@ -0,0 +1,6 @@
1.112 ++{header}
1.113 ++# HG graph
1.114 ++# Node ID {node}
1.115 ++# Rows shown {rows}
1.116 ++
1.117 ++{nodes%graphnode}
1.118 +diff -r 99f369f5a8db -r 6bf09cdbff53 mercurial/templates/raw/graphedge.tmpl
1.119 +--- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.120 ++++ b/mercurial/templates/raw/graphedge.tmpl Mon May 21 00:20:05 2012 +0200
1.121 +@@ -0,0 +1,1 @@
1.122 ++edge: ({col}, {row}) -> ({nextcol}, {nextrow}) (color {color})
1.123 +diff -r 99f369f5a8db -r 6bf09cdbff53 mercurial/templates/raw/graphnode.tmpl
1.124 +--- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.125 ++++ b/mercurial/templates/raw/graphnode.tmpl Mon May 21 00:20:05 2012 +0200
1.126 +@@ -0,0 +1,7 @@
1.127 ++changeset: {node}
1.128 ++user: {user}
1.129 ++date: {age}
1.130 ++summary: {desc}
1.131 ++{branches%branchname}{tags%tagname}{bookmarks%bookmarkname}
1.132 ++node: ({col}, {row}) (color {color})
1.133 ++{edges%graphedge}
1.134 +diff -r 99f369f5a8db -r 6bf09cdbff53 mercurial/templates/raw/map
1.135 +--- a/mercurial/templates/raw/map Tue May 15 07:01:35 2012 +0200
1.136 ++++ b/mercurial/templates/raw/map Mon May 21 00:20:05 2012 +0200
1.137 @@ -28,3 +28,9 @@
1.138 bookmarkentry = '{bookmark} {node}\n'
1.139 branches = '{entries%branchentry}'
1.140 @@ -121,10 +155,10 @@
1.141 +bookmarkname = 'bookmark: {name}\n'
1.142 +branchname = 'branch: {name}\n'
1.143 +tagname = 'tag: {name}\n'
1.144 -diff -r d7c9976b930e -r 9488fd4c0587 tests/test-hgweb-commands.t
1.145 ---- a/tests/test-hgweb-commands.t Wed May 02 13:20:06 2012 +0200
1.146 -+++ b/tests/test-hgweb-commands.t Sun May 20 18:35:23 2012 +0200
1.147 -@@ -1038,6 +1038,55 @@
1.148 +diff -r 99f369f5a8db -r 6bf09cdbff53 tests/test-hgweb-commands.t
1.149 +--- a/tests/test-hgweb-commands.t Tue May 15 07:01:35 2012 +0200
1.150 ++++ b/tests/test-hgweb-commands.t Mon May 21 00:20:05 2012 +0200
1.151 +@@ -1047,6 +1047,55 @@
1.152 </body>
1.153 </html>
1.154