changeset 6720:084c9f1ef2bd

graph: display branch name alongside tags
author Dirkjan Ochtman <dirkjan@ochtman.nl>
date Mon, 23 Jun 2008 12:54:27 +0200
parents 42dbf9548bc6
children 521c6c6f3b9b
files mercurial/hgweb/webcommands.py templates/coal/graph.tmpl templates/gitweb/graph.tmpl
diffstat 3 files changed, 21 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/hgweb/webcommands.py	Mon Jun 23 10:36:00 2008 +0200
+++ b/mercurial/hgweb/webcommands.py	Mon Jun 23 12:54:27 2008 +0200
@@ -602,7 +602,9 @@
         desc = templatefilters.firstline(ctx.description())
         desc = cgi.escape(desc)
         user = cgi.escape(templatefilters.person(ctx.user()))
-        data.append((node, vtx, edges, desc, user, age, ctx.tags()))
+        branch = ctx.branch()
+        branch = branch, web.repo.branchtags().get(branch) == ctx.node()
+        data.append((node, vtx, edges, desc, user, age, branch, ctx.tags()))
 
     return tmpl('graph', rev=rev, revcount=revcount, uprev=uprev,
                 lessrev=lessrev, revcountmore=revcount and 2 * revcount or 1,
--- a/templates/coal/graph.tmpl	Mon Jun 23 10:36:00 2008 +0200
+++ b/templates/coal/graph.tmpl	Mon Jun 23 12:54:27 2008 +0200
@@ -94,7 +94,7 @@
 	item = item.replace(/_DESC/, cur[3]);
 	item = item.replace(/_USER/, cur[4]);
 	item = item.replace(/_DATE/, cur[5]);
-	item = item.replace(/_TAGS/, cur[6].join('&nbsp; '));
+	item = item.replace(/_TAGS/, cur[7].join('&nbsp; '));
 	nodes.innerHTML += item;
 	
 }
--- a/templates/gitweb/graph.tmpl	Mon Jun 23 10:36:00 2008 +0200
+++ b/templates/gitweb/graph.tmpl	Mon Jun 23 12:54:27 2008 +0200
@@ -86,16 +86,26 @@
 	item = item.replace(/_DESC/, cur[3]);
 	item = item.replace(/_USER/, cur[4]);
 	item = item.replace(/_DATE/, cur[5]);
-	if (cur[6].length) {
-		var tagspan = '<span class="logtags">';
-		for (var t in cur[6]) {
-			var tag = cur[6][t];
-			tagspan += '<span class="tagtag">' + tag + '</span> ';
+	
+	var tagspan = '';
+	if (cur[7].length || (cur[6][0] != 'default' || cur[6][1])) {
+		tagspan = '<span class="logtags">';
+		if (cur[6][1]) {
+			tagspan += '<span class="branchtag" title="' + cur[6][0] + '">';
+			tagspan += cur[6][0] + '</span> ';
+		} else if (!cur[6][1] && cur[6][0] != 'default') {
+			tagspan += '<span class="inbranchtag" title="' + cur[6][0] + '">';
+			tagspan += cur[6][0] + '</span> ';
+		}
+		if (cur[7].length) {
+			for (var t in cur[7]) {
+				var tag = cur[7][t];
+				tagspan += '<span class="tagtag">' + tag + '</span> ';
+			}
 		}
 		tagspan += '</span>';
-	} else {
-		tagspan = '';
 	}
+	
 	item = item.replace(/_TAGS/, tagspan);
 	nodes.innerHTML += item;