# HG changeset patch # User greg@maptuit.com # Date 1174082142 14400 # Node ID 05d15c456fb2a060f2b76009d7827e0ac5b01609 # Parent 6b1e1b9da8539ddcee482d287f7ea13809583a5d hgweb: display named branches in gitweb-style summary page diff -r 6b1e1b9da853 -r 05d15c456fb2 mercurial/hgweb/hgweb_mod.py --- a/mercurial/hgweb/hgweb_mod.py Tue Mar 27 01:41:23 2007 -0300 +++ b/mercurial/hgweb/hgweb_mod.py Fri Mar 16 17:55:42 2007 -0400 @@ -530,6 +530,23 @@ date=self.repo.changectx(n).date()) parity += 1 + + def branches(**map): + parity = 0 + + b = self.repo.branchtags() + l = [(-self.repo.changelog.rev(n), n, t) for t, n in b.items()] + l.sort() + + for r,n,t in l: + ctx = self.repo.changectx(n) + + yield {'parity': self.stripes(parity), + 'branch': t, + 'node': hex(n), + 'date': ctx.date()} + parity += 1 + def heads(**map): parity = 0 count = 0 @@ -578,6 +595,7 @@ self.config("web", "author", "unknown")), # also lastchange=cl.read(cl.tip())[2], tags=tagentries, + branches=branches, heads=heads, shortlog=changelist, node=hex(cl.tip()), diff -r 6b1e1b9da853 -r 05d15c456fb2 templates/gitweb/map --- a/templates/gitweb/map Tue Mar 27 01:41:23 2007 -0300 +++ b/templates/gitweb/map Fri Mar 16 17:55:42 2007 -0400 @@ -40,6 +40,7 @@ tags = tags.tmpl tagentry = '#date|age# ago#tag|escape#changeset | changelog | manifest' headentry = '{date|age} ago{node|short}{branch|escape}changeset | changelog | manifest' +branchentry = '{date|age} ago{node|short}{branch|escape}changeset | changelog | manifest' diffblock = '
#lines#
' changelogtag = 'tag:#tag|escape#' changesettag = 'tag#tag|escape#' diff -r 6b1e1b9da853 -r 05d15c456fb2 templates/gitweb/summary.tmpl --- a/templates/gitweb/summary.tmpl Tue Mar 27 01:41:23 2007 -0300 +++ b/templates/gitweb/summary.tmpl Fri Mar 16 17:55:42 2007 -0400 @@ -36,8 +36,15 @@ ... -
heads
+
branches
+ +{branches%branchentry} + + + +
...
+ +
heads
{heads%headentry}