# HG changeset patch # User Josef "Jeff" Sipek # Date 2007-06-01 23:56:39 # Node ID 4272ae760bb183ab0a44371b6650cf3af1d75af4 # Parent 2f489b00f8ebe1322cf92ceab832d82f34f34a15 gitweb: Display branch and tag labels Pages which display labels: - summary - shortlog - changelog - changeset - search diff --git a/mercurial/hgweb/hgweb_mod.py b/mercurial/hgweb/hgweb_mod.py --- a/mercurial/hgweb/hgweb_mod.py +++ b/mercurial/hgweb/hgweb_mod.py @@ -133,6 +133,16 @@ class hgweb(object): 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 @@ class hgweb(object): "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 @@ class hgweb(object): 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 @@ class hgweb(object): 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 @@ class hgweb(object): 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 @@ class hgweb(object): 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 @@ class hgweb(object): desc=ctx.description(), date=ctx.date(), rev=i, - node=hn)) + node=hn, + tags=self.taglistdict(n), + branches=self.branchlistdict(n))) yield l diff --git a/templates/gitweb/changelogentry.tmpl b/templates/gitweb/changelogentry.tmpl --- a/templates/gitweb/changelogentry.tmpl +++ b/templates/gitweb/changelogentry.tmpl @@ -1,5 +1,5 @@
-#date|age# ago#desc|strip|firstline|escape# +#date|age# ago#desc|strip|firstline|escape# {branches%branchtag}{tags%tagtag}
-#desc|strip|escape|firstline# +#desc|strip|escape|firstline# {branches%branchtag}{tags%tagtag}
@@ -23,7 +23,6 @@ #parent%changesetparent# #child%changesetchild# -#changesettag#
changeset {rev}{node|short}
diff --git a/templates/gitweb/manifest.tmpl b/templates/gitweb/manifest.tmpl --- a/templates/gitweb/manifest.tmpl +++ b/templates/gitweb/manifest.tmpl @@ -18,7 +18,7 @@ manifest | changeset #archives%archiveentry#
-
#path|escape#
+
#path|escape# {branches%branchtag}{tags%tagtag}
diff --git a/templates/gitweb/map b/templates/gitweb/map --- a/templates/gitweb/map +++ b/templates/gitweb/map @@ -41,14 +41,14 @@ tags = tags.tmpl tagentry = '' branchentry = '' diffblock = '
#lines#
' -changelogtag = '' -changesettag = '' filediffparent = '' filelogparent = '' filediffchild = '' filelogchild = '' shortlog = shortlog.tmpl -shortlogentry = '' +tagtag = '{name} ' +branchtag = '{name} ' +shortlogentry = '' filelogentry = '' archiveentry = ' | #type|escape# ' indexentry = '' diff --git a/templates/static/style-gitweb.css b/templates/static/style-gitweb.css --- a/templates/static/style-gitweb.css +++ b/templates/static/style-gitweb.css @@ -48,3 +48,19 @@ a.rss_logo { } 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; +}
drwxr-xr-x
#date|age# ago#tag|escape#
{date|age} ago{node|short}{branch|escape}
tag:#tag|escape#
tag#tag|escape#
parent {rev}{node|short}
parent #rev#: #node|short#
child {rev}{node|short}
child #rev#: #node|short#
#date|age# ago#author|obfuscate##desc|strip|firstline|escape#
#date|age# ago#author##desc|strip|firstline|escape# {branches%branchtag}{tags%tagtag}
#date|age# ago#desc|strip|firstline|escape#
#name|escape##description##contact|obfuscate##lastchange|age# ago