diff -r 55982f62651f mercurial/hgweb/webcommands.py
--- a/mercurial/hgweb/webcommands.py	Wed Apr 18 01:20:16 2012 +0300
+++ b/mercurial/hgweb/webcommands.py	Sat Apr 28 01:19:59 2012 +0200
@@ -785,6 +785,8 @@
     tree = list(graphmod.colored(dag, web.repo))
     canvasheight = (len(tree) + 1) * bg_height - 27
     data = []
+    cols = 0
+    row = 0
     for (id, type, ctx, vtx, edges) in tree:
         if type != graphmod.CHANGESET:
             continue
@@ -795,13 +797,38 @@
         user = cgi.escape(templatefilters.person(ctx.user()))
         branch = ctx.branch()
         branch = branch, web.repo.branchtags().get(branch) == ctx.node()
-        data.append((node, vtx, edges, desc, user, age, branch, ctx.tags(),
-                     ctx.bookmarks()))
+
+        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,
+                         edges=edgedata,
+                         row=row,
+                         nextrow=row+1,
+                         bg_height=bg_height,
+                         desc=desc,
+                         user=user,
+                         age=age,
+                         branchname=branch[0],
+                         branchtip=branch[1],
+                         bookmarks=webutil.nodebookmarksdict(web.repo, ctx.node()),
+                         branches=webutil.nodebranchdict(web.repo, ctx),
+                         inbranch=webutil.nodeinbranch(web.repo, ctx),
+                         tags=webutil.nodetagsdict(web.repo, ctx.node())))
+
+        cols = max(cols, max([edge[0] for edge in edges] or [0]),
+                         max([edge[1] for edge in edges] or [0]))
+        row += 1
 
     return tmpl('graph', rev=rev, revcount=revcount, uprev=uprev,
                 lessvars=lessvars, morevars=morevars, downrev=downrev,
                 canvasheight=canvasheight, jsdata=data, bg_height=bg_height,
-                node=revnode_hex, changenav=changenav)
+                node=revnode_hex, changenav=changenav,
+                rows=row, cols=cols, canvaswidth=(cols+1)*bg_height,
+                truecanvasheight=row*bg_height)
 
 def _getdoc(e):
     doc = e[0].__doc__
diff -r 55982f62651f mercurial/templates/static/mercurial.js
--- a/mercurial/templates/static/mercurial.js	Wed Apr 18 01:20:16 2012 +0300
+++ b/mercurial/templates/static/mercurial.js	Sat Apr 28 01:19:59 2012 +0200
@@ -108,21 +108,22 @@
 			this.bg[1] += this.bg_height;
 			
 			var cur = data[i];
-			var node = cur[1];
-			var edges = cur[2];
+			var column = cur["col"];
+			var color;
+			var edges = cur["edges"];
 			var fold = false;
 			
 			var prevWidth = this.ctx.lineWidth;
 			for (var j in edges) {
 				
 				line = edges[j];
-				start = line[0];
-				end = line[1];
-				color = line[2];
-				var width = line[3];
+				start = line["col"];
+				end = line["nextcol"];
+				color = line["color"];
+				var width = line["width"];
 				if(width < 0)
 					 width = prevWidth;
-				var branchcolor = line[4];
+				var branchcolor = line["bcolor"];
 				if(branchcolor)
 					color = branchcolor;
 				
@@ -146,13 +147,12 @@
 			
 			// Draw the revision node in the right column
 			
-			column = node[0]
-			color = node[1]
+			color = cur["color"];
 			
 			radius = this.box_size / 8;
 			x = this.cell[0] + this.box_size * column + this.box_size / 2;
 			y = this.bg[1] - this.bg_height / 2;
-			var add = this.vertex(x, y, color, parity, cur);
+			var add = this.vertexForEntry(x, y, color, parity, cur);
 			backgrounds += add[0];
 			nodedata += add[1];
 			
@@ -165,6 +165,21 @@
 		
 	}
 
+	this.vertexForEntry = function(x, y, color, parity, cur) {
+		var tags = [], bookmarks = [];
+		for (var i in cur["tags"]) {
+			tags.push(cur["tags"][i]["name"]);
+		}
+		for (var i in cur["bookmarks"]) {
+			bookmarks.push(cur["bookmarks"][i]["name"]);
+		}
+		return this.vertex(x, y, color, parity, [
+			cur["node"], [cur["col"], cur["color"]],
+			cur["edges"], cur["desc"], cur["user"], cur["age"],
+			[cur["branchname"], cur["branchtip"]],
+			tags, bookmarks
+			])
+	}
 }
 
 
