gitweb: Display branch and tag labels
Pages which display labels:
- summary
- shortlog
- changelog
- changeset
- search
--- a/mercurial/hgweb/hgweb_mod.py Sun Jun 10 21:05:01 2007 -0700
+++ b/mercurial/hgweb/hgweb_mod.py Fri Jun 01 19:56:39 2007 -0400
@@ -133,6 +133,16 @@
return [dict(file=r[0], node=hex(r[1]))]
return []
+ def taglistdict(self,node):
+ return [{"name":i} for i in self.repo.nodetags(node)]
+
+ def branchlistdict(self,node):
+ l=[]
+ for t, tn in self.repo.branchtags().items():
+ if tn == node:
+ l.append({"name":t})
+ return l
+
def showtag(self, t1, node=nullid, **args):
for t in self.repo.nodetags(node):
yield self.t(t1, tag=t, **args)
@@ -211,7 +221,9 @@
"date": ctx.date(),
"files": self.listfilediffs(ctx.files(), n),
"rev": i,
- "node": hex(n)})
+ "node": hex(n),
+ "tags": self.taglistdict(n),
+ "branches": self.branchlistdict(n)})
for e in l:
yield e
@@ -274,7 +286,9 @@
date=ctx.date(),
files=self.listfilediffs(ctx.files(), n),
rev=ctx.rev(),
- node=hex(n))
+ node=hex(n),
+ tags=self.taglistdict(n),
+ branches=self.branchlistdict(n))
if count >= self.maxchanges:
break
@@ -314,7 +328,9 @@
desc=ctx.description(),
date=ctx.date(),
files=files,
- archives=self.archivelist(hex(n)))
+ archives=self.archivelist(hex(n)),
+ tags=self.taglistdict(n),
+ branches=self.branchlistdict(n))
def filelog(self, fctx):
f = fctx.path()
@@ -482,7 +498,9 @@
upparity=parity.next(),
fentries=filelist,
dentries=dirlist,
- archives=self.archivelist(hex(node)))
+ archives=self.archivelist(hex(node)),
+ tags=self.taglistdict(node),
+ branches=self.branchlistdict(node))
def tags(self):
i = self.repo.tagslist()
@@ -545,7 +563,8 @@
l = [] # build a list in forward order for efficiency
for i in xrange(start, end):
ctx = self.repo.changectx(i)
- hn = hex(ctx.node())
+ n = ctx.node()
+ hn = hex(n)
l.insert(0, self.t(
'shortlogentry',
@@ -554,7 +573,9 @@
desc=ctx.description(),
date=ctx.date(),
rev=i,
- node=hn))
+ node=hn,
+ tags=self.taglistdict(n),
+ branches=self.branchlistdict(n)))
yield l
--- a/templates/gitweb/changelogentry.tmpl Sun Jun 10 21:05:01 2007 -0700
+++ b/templates/gitweb/changelogentry.tmpl Fri Jun 01 19:56:39 2007 -0400
@@ -1,5 +1,5 @@
<div>
-<a class="title" href="{url}rev/#node|short#{sessionvars%urlparameter}"><span class="age">#date|age# ago</span>#desc|strip|firstline|escape#</a>
+<a class="title" href="{url}rev/#node|short#{sessionvars%urlparameter}"><span class="age">#date|age# ago</span>#desc|strip|firstline|escape#<span class="logtags"> {branches%branchtag}{tags%tagtag}</span></a>
</div>
<div class="title_text">
<div class="log_link">
--- a/templates/gitweb/changeset.tmpl Sun Jun 10 21:05:01 2007 -0700
+++ b/templates/gitweb/changeset.tmpl Fri Jun 01 19:56:39 2007 -0400
@@ -14,7 +14,7 @@
</div>
<div>
-<a class="title" href="{url}raw-rev/#node|short#">#desc|strip|escape|firstline#</a>
+<a class="title" href="{url}raw-rev/#node|short#">#desc|strip|escape|firstline# <span class="logtags">{branches%branchtag}{tags%tagtag}</span></a>
</div>
<div class="title_text">
<table cellspacing="0">
@@ -23,7 +23,6 @@
<tr><td>changeset {rev}</td><td style="font-family:monospace">{node|short}</td></tr>
#parent%changesetparent#
#child%changesetchild#
-#changesettag#
</table></div>
<div class="page_body">
--- a/templates/gitweb/manifest.tmpl Sun Jun 10 21:05:01 2007 -0700
+++ b/templates/gitweb/manifest.tmpl Fri Jun 01 19:56:39 2007 -0400
@@ -18,7 +18,7 @@
<a href="{url}rev/#node|short#{sessionvars%urlparameter}">changeset</a> #archives%archiveentry#<br/>
</div>
-<div class="title" >#path|escape#</div>
+<div class="title">#path|escape# <span class="logtags">{branches%branchtag}{tags%tagtag}</span></div>
<table cellspacing="0">
<tr class="parity#upparity#">
<td style="font-family:monospace">drwxr-xr-x</td>
--- a/templates/gitweb/map Sun Jun 10 21:05:01 2007 -0700
+++ b/templates/gitweb/map Fri Jun 01 19:56:39 2007 -0400
@@ -41,14 +41,14 @@
tagentry = '<tr class="parity#parity#"><td class="age"><i>#date|age# ago</i></td><td><a class="list" href="{url}rev/{node|short}{sessionvars%urlparameter}"><b>#tag|escape#</b></a></td><td class="link"><a href="{url}rev/#node|short#{sessionvars%urlparameter}">changeset</a> | <a href="{url}log/#node|short#{sessionvars%urlparameter}">changelog</a> | <a href="{url}file/#node|short#{sessionvars%urlparameter}">manifest</a></td></tr>'
branchentry = '<tr class="parity{parity}"><td class="age"><i>{date|age} ago</i></td><td><a class="list" href="{url}rev/{node|short}{sessionvars%urlparameter}"><b>{node|short}</b></td><td>{branch|escape}</td><td class="link"><a href="{url}rev/{node|short}{sessionvars%urlparameter}">changeset</a> | <a href="{url}log/{node|short}{sessionvars%urlparameter}">changelog</a> | <a href="{url}file/{node|short}{sessionvars%urlparameter}">manifest</a></td></tr>'
diffblock = '<pre>#lines#</pre>'
-changelogtag = '<tr><th class="tag">tag:</th><td class="tag">#tag|escape#</td></tr>'
-changesettag = '<tr><td>tag</td><td>#tag|escape#</td></tr>'
filediffparent = '<tr><td>parent {rev}</td><td style="font-family:monospace"><a class="list" href="{url}diff/{node|short}/{file|urlescape}{sessionvars%urlparameter}">{node|short}</a></td></tr>'
filelogparent = '<tr><td align="right">parent #rev#: </td><td><a href="{url}file/{node|short}/#file|urlescape#{sessionvars%urlparameter}">#node|short#</a></td></tr>'
filediffchild = '<tr><td>child {rev}</td><td style="font-family:monospace"><a class="list" href="{url}diff/{node|short}/{file|urlescape}{sessionvars%urlparameter}">{node|short}</a></td></tr>'
filelogchild = '<tr><td align="right">child #rev#: </td><td><a href="{url}file{node|short}/#file|urlescape#{sessionvars%urlparameter}">#node|short#</a></td></tr>'
shortlog = shortlog.tmpl
-shortlogentry = '<tr class="parity#parity#"><td class="age"><i>#date|age# ago</i></td><td><i>#author|obfuscate#</i></td><td><a class="list" href="{url}rev/#node|short#{sessionvars%urlparameter}"><b>#desc|strip|firstline|escape#</b></a></td><td class="link" nowrap><a href="{url}rev/#node|short#{sessionvars%urlparameter}">changeset</a> | <a href="{url}file/#node|short#{sessionvars%urlparameter}">manifest</a></td></tr>'
+tagtag = '<span class="tagtag" title="{name}">{name}</span> '
+branchtag = '<span class="branchtag" title="{name}">{name}</span> '
+shortlogentry = '<tr class="parity#parity#"><td class="age"><i>#date|age# ago</i></td><td><i>#author#</i></td><td><a class="list" href="{url}rev/#node|short#{sessionvars%urlparameter}"><b>#desc|strip|firstline|escape#</b> <span class="logtags">{branches%branchtag}{tags%tagtag}</span></a></td><td class="link" nowrap><a href="{url}rev/#node|short#{sessionvars%urlparameter}">changeset</a> | <a href="{url}file/#node|short#{sessionvars%urlparameter}">manifest</a></td></tr>'
filelogentry = '<tr class="parity#parity#"><td class="age"><i>#date|age# ago</i></td><td><a class="list" href="{url}rev/#node|short#{sessionvars%urlparameter}"><b>#desc|strip|firstline|escape#</b></a></td><td class="link"><a href="{url}file/#node|short#/#file|urlescape#{sessionvars%urlparameter}">file</a> | <a href="{url}diff/#node|short#/#file|urlescape#{sessionvars%urlparameter}">diff</a> | <a href="{url}annotate/#node|short#/#file|urlescape#{sessionvars%urlparameter}">annotate</a> #rename%filelogrename#</td></tr>'
archiveentry = ' | <a href="{url}archive/{node|short}{extension}">#type|escape#</a> '
indexentry = '<tr class="parity#parity#"><td><a class="list" href="#url#{sessionvars%urlparameter}"><b>#name|escape#</b></a></td><td>#description#</td><td>#contact|obfuscate#</td><td class="age">#lastchange|age# ago</td><td class="indexlinks"><a class="rss_logo" href="#url#rss-log">RSS</a> #archives%archiveentry#</td></tr>'
--- a/templates/static/style-gitweb.css Sun Jun 10 21:05:01 2007 -0700
+++ b/templates/static/style-gitweb.css Fri Jun 01 19:56:39 2007 -0400
@@ -48,3 +48,19 @@
}
a.rss_logo:hover { background-color:#ee5500; }
pre { margin: 0; }
+span.logtags span {
+ padding: 0px 4px;
+ font-size: 10px;
+ font-weight: normal;
+ border: 1px solid;
+ background-color: #ffaaff;
+ border-color: #ffccff #ff00ee #ff00ee #ffccff;
+}
+span.logtags span.tagtag {
+ background-color: #ffffaa;
+ border-color: #ffffcc #ffee00 #ffee00 #ffffcc;
+}
+span.logtags span.branchtag {
+ background-color: #aaffaa;
+ border-color: #ccffcc #00cc33 #00cc33 #ccffcc;
+}