[PATCHES] [RFC] Display branchnames
Ben
benoit.allard at gmx.de
Wed Jun 18 18:08:19 CDT 2008
I have a set of patches to display the name of the branches in the new
web branch view (gitweb, and coal/paper) as wel as in the shortlog
view.
I uploaded some screenshots on my wiki page as I miss a web server ...
http://www.selenic.com/mercurial/wiki/index.cgi/BenoitAllard
patches follows:
# HG changeset patch
# User Benoit Allard <benoit at aeteurope.nl>
# Date 1213825742 -7200
# Node ID 31ec78d7812c7bf48bce7976d3990c714a4de551
# Parent 97cc6b29125c6b5562f1741bf00547abbcd220f7
coal: display the branch name
diff -r 97cc6b29125c -r 31ec78d7812c templates/coal/map
--- a/templates/coal/map Wed Jun 18 23:16:51 2008 +0200
+++ b/templates/coal/map Wed Jun 18 23:49:02 2008 +0200
@@ -56,6 +56,8 @@
tags = tags.tmpl
tagentry = '<tr class="tagEntry parity{parity}"><td><a
href="{url}rev/{node|short}{sessionvars%urlparameter}">{tag|escape}</a></td><td
class="node">{node|short}</td></tr>'
changelogtag = '<span class="tag">{name|escape}</span> '
+changelogbranch = '<span class="branchhead">{name|escape}</span> '
+changeloginbranch = '<span class="branchname">{name|escape}</span>'
changesettag = '<span class="tag">{tag|escape}</span> '
filediffparent = '<tr><th class="parent">parent {rev}:</th><td
class="parent"><a
href="{url}rev/{node|short}{sessionvars%urlparameter}">{node|short}</a></td></tr>'
filelogparent = '<tr><th>parent {rev}:</th><td><a
href="{url}file/{node|short}/{file|urlescape}{sessionvars%urlparameter}">{node|short}</a></td></tr>'
diff -r 97cc6b29125c -r 31ec78d7812c templates/coal/shortlogentry.tmpl
--- a/templates/coal/shortlogentry.tmpl Wed Jun 18 23:16:51 2008 +0200
+++ b/templates/coal/shortlogentry.tmpl Wed Jun 18 23:49:02 2008 +0200
@@ -1,5 +1,5 @@
<tr class="parity{parity}">
<td class="age">{date|age}</td>
<td class="author">{author|person}</td>
- <td class="description"><a
href="{url}rev/{node|short}{sessionvars%urlparameter}">{desc|strip|firstline|escape}</a>{tags%changelogtag}</td>
+ <td class="description"><a
href="{url}rev/{node|short}{sessionvars%urlparameter}">{desc|strip|firstline|escape}</a>{inbranch%changeloginbranch}{branches%changelogbranch}{tags%changelogtag}</td>
</tr>
diff -r 97cc6b29125c -r 31ec78d7812c templates/static/style-coal.css
--- a/templates/static/style-coal.css Wed Jun 18 23:16:51 2008 +0200
+++ b/templates/static/style-coal.css Wed Jun 18 23:49:02 2008 +0200
@@ -81,6 +81,22 @@
.tag {
color: #999;
font-size: 70%;
+ font-weight: normal;
+ margin-left: .5em;
+ vertical-align: baseline;
+}
+
+.branchhead {
+ color: #cc0066;
+ font-size: 80%;
+ font-weight: normal;
+ margin-left: .5em;
+ vertical-align: baseline;
+}
+
+.branchname {
+ color: #ee8800;
+ font-size: 60%;
font-weight: normal;
margin-left: .5em;
vertical-align: baseline;
# HG changeset patch
# User Benoit Allard <benoit at aeteurope.nl>
# Date 1213826684 -7200
# Node ID 0fcb81696e7584b8c7dbe75996ea1f513351dfb7
# Parent 31ec78d7812c7bf48bce7976d3990c714a4de551
paper: display the branch name
diff -r 31ec78d7812c -r 0fcb81696e75 templates/paper/map
--- a/templates/paper/map Wed Jun 18 23:49:02 2008 +0200
+++ b/templates/paper/map Thu Jun 19 00:04:44 2008 +0200
@@ -55,8 +55,9 @@
fileannotatechild = '<tr><td class="metatag">child:</td><td><a
href="{url}annotate/{node|short}/{file|urlescape}{sessionvars%urlparameter}">{node|short}</a></td></tr>'
tags = ../coal/tags.tmpl
tagentry = '<tr class="tagEntry parity{parity}"><td><a
href="{url}rev/{node|short}{sessionvars%urlparameter}">{tag|escape}</a></td><td
class="node">{node|short}</td></tr>'
-changelogtag = '<tr><th class="tag">tag:</th><td
class="tag">{tag|escape}</td></tr>'
changelogtag = '<span class="tag">{name|escape}</span> '
+changelogbranch = '<span class="branchhead">{name|escape}</span> '
+changeloginbranch = '<span class="branchname">{name|escape}</span> '
changesettag = '<span class="tag">{tag|escape}</span> '
filediffparent = '<tr><th class="parent">parent {rev}:</th><td
class="parent"><a
href="{url}rev/{node|short}{sessionvars%urlparameter}">{node|short}</a></td></tr>'
filelogparent = '<tr><th>parent {rev}:</th><td><a
href="{url}file/{node|short}/{file|urlescape}{sessionvars%urlparameter}">{node|short}</a></td></tr>'
diff -r 31ec78d7812c -r 0fcb81696e75 templates/static/style-paper.css
--- a/templates/static/style-paper.css Wed Jun 18 23:49:02 2008 +0200
+++ b/templates/static/style-paper.css Thu Jun 19 00:04:44 2008 +0200
@@ -77,6 +77,22 @@
.tag {
color: #999;
font-size: 70%;
+ font-weight: normal;
+ margin-left: .5em;
+ vertical-align: baseline;
+}
+
+.branchhead {
+ color: #cc0066;
+ font-size: 80%;
+ font-weight: normal;
+ margin-left: .5em;
+ vertical-align: baseline;
+}
+
+.branchname {
+ color: #ee8800;
+ font-size: 60%;
font-weight: normal;
margin-left: .5em;
vertical-align: baseline;
# HG changeset patch
# User Benoit Allard <benoit at aeteurope.nl>
# Date 1213813972 -7200
# Node ID ecffa32db5a0c33bac56eeedbb3e3661269e7608
# Parent 0fcb81696e7584b8c7dbe75996ea1f513351dfb7
graph: display branch name alongside tags
diff -r 0fcb81696e75 -r ecffa32db5a0 mercurial/hgweb/webcommands.py
--- a/mercurial/hgweb/webcommands.py Thu Jun 19 00:04:44 2008 +0200
+++ b/mercurial/hgweb/webcommands.py Wed Jun 18 20:32:52 2008 +0200
@@ -602,7 +602,10 @@
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()))
+ inbranch = webutil.nodeinbranch(web.repo, ctx)
+ branch = webutil.nodebranchdict(web.repo, ctx)
+ branchinfo = {'inbranch' : inbranch, 'branch':branch}
+ data.append((node, vtx, edges, desc, user, age, branchinfo,
ctx.tags()))
return tmpl('graph', rev=rev, revcount=revcount, uprev=uprev,
lessrev=lessrev, revcountmore=revcount and 2 * revcount or 1,
diff -r 0fcb81696e75 -r ecffa32db5a0 templates/coal/graph.tmpl
--- a/templates/coal/graph.tmpl Thu Jun 19 00:04:44 2008 +0200
+++ b/templates/coal/graph.tmpl Wed Jun 18 20:32:52 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(' '));
+ item = item.replace(/_TAGS/, cur[7].join(' '));
nodes.innerHTML += item;
}
diff -r 0fcb81696e75 -r ecffa32db5a0 templates/gitweb/graph.tmpl
--- a/templates/gitweb/graph.tmpl Thu Jun 19 00:04:44 2008 +0200
+++ b/templates/gitweb/graph.tmpl Wed Jun 18 20:32:52 2008 +0200
@@ -86,15 +86,25 @@
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> ';
- }
- tagspan += '</span>';
- } else {
- tagspan = '';
+ var hastag = cur[6].inbranch.length || cur[6].branch.length || cur[7].length;
+ var tagspan = '';
+ if (hastag){
+ tagspan = '<span class="logtags">';
+ if (cur[6].inbranch.length){
+ var branch = cur[6].inbranch[0].name;
+ tagspan += '<span class="inbranchtag" title="' + branch + '">'
+ branch + '</span>';
+ }
+ else if (cur[6].branch.length){
+ var branch = cur[6].branch[0].name;
+ tagspan += '<span class="branchtag" title="' + branch + '">' +
branch + '</span>';
+ }
+ if (cur[7].length) {
+ for (var t in cur[7]) {
+ var tag = cur[7][t];
+ tagspan += '<span class="tagtag">' + tag + '</span> ';
+ }
+ }
+ tagspan += '</span>';
}
item = item.replace(/_TAGS/, tagspan);
nodes.innerHTML += item;
More information about the Mercurial-devel
mailing list