hgweb: add heads to gitweb summary
authorBrendan Cully <brendan@kublai.com>
Tue, 24 Oct 2006 13:31:01 -0700
changeset 3499 e0db0b7934f2
parent 3498 776c317566b6
child 3500 bd8339976504
hgweb: add heads to gitweb summary
mercurial/hgweb/hgweb_mod.py
templates/gitweb/map
templates/gitweb/summary.tmpl
--- a/mercurial/hgweb/hgweb_mod.py	Tue Oct 24 13:17:41 2006 -0700
+++ b/mercurial/hgweb/hgweb_mod.py	Tue Oct 24 13:31:01 2006 -0700
@@ -527,6 +527,23 @@
                              date = t)
                 parity += 1
 
+        def heads(**map):
+            parity = 0
+            count = 0
+
+            for node in self.repo.heads():
+                count += 1
+                if count > 10:
+                    break;
+
+                ctx = self.repo.changectx(node)
+
+                yield {'parity': self.stripes(parity),
+                       'branch': ctx.branch(),
+                       'node': hex(node),
+                       'date': ctx.date()}
+                parity += 1
+
         def changelist(**map):
             parity = 0
             cl = self.repo.changelog
@@ -560,6 +577,7 @@
                           self.repo.ui.config("web", "author", "unknown")), # also
                  lastchange = cl.read(cl.tip())[2],
                  tags = tagentries,
+                 heads = heads,
                  shortlog = changelist,
                  node = hex(cl.tip()),
                  archives=self.archivelist("tip"))
--- a/templates/gitweb/map	Tue Oct 24 13:17:41 2006 -0700
+++ b/templates/gitweb/map	Tue Oct 24 13:31:01 2006 -0700
@@ -39,6 +39,7 @@
 fileannotatechild = '<tr><td class="metatag">child {rev}:</td><td><a href="{url}annotate/{node|short}/{file|urlescape}{sessionvars%urlparameter}">{node|short}</a></td></tr>'
 tags = tags.tmpl
 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>'
+headentry = '<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}</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>'
--- a/templates/gitweb/summary.tmpl	Tue Oct 24 13:17:41 2006 -0700
+++ b/templates/gitweb/summary.tmpl	Tue Oct 24 13:31:01 2006 -0700
@@ -36,4 +36,12 @@
 <tr class="light"><td colspan="3"><a class="list" href="{url}tags{sessionvars%urlparameter}">...</a></td></tr>
 </table>
 
+<div><a class="title"
+href="#">heads</a></div>
+<table cellspacing="0">
+{heads%headentry}
+<tr class="light">
+  <td colspan="3"><a class="list"  href="#">...</a></td>
+</tr>
+</table>
 #footer#