[PATCH] hgweb: add heads to gitweb summary

Brendan Cully brendan at kublai.com
Thu Oct 12 22:37:25 UTC 2006


# HG changeset patch
# User Brendan Cully <brendan at kublai.com>
# Date 1160692492 25200
# Node ID 627a3852ee2231605039dc4aa9d214a3bb07e285
# Parent  b9a7c07fca0e3610296261424d17b4c37e70afc3
hgweb: add heads to gitweb summary

diff -r b9a7c07fca0e -r 627a3852ee22 mercurial/hgweb/hgweb_mod.py
--- a/mercurial/hgweb/hgweb_mod.py	Thu Oct 12 14:19:34 2006 -0700
+++ b/mercurial/hgweb/hgweb_mod.py	Thu Oct 12 15:34:52 2006 -0700
@@ -507,6 +507,28 @@ class hgweb(object):
                              date = t)
                 parity += 1
 
+        def heads(**map):
+            parity = 0
+            count = 0
+
+            branches = self.repo.branchlookup(self.repo.heads())
+            revs = dict.fromkeys([cl.rev(n) for n in branches]).keys()
+            revs.sort()
+            revs.reverse()
+            for node in [cl.node(n) for n in revs]:
+                c = cl.read(node)
+                for name in branches[node]:
+                    count += 1
+                    if count > 10:
+                        break;
+
+                    yield self.t('tagentry',
+                                 parity = self.stripes(parity),
+                                 tag = name,
+                                 node = hex(node),
+                                 date = c[2])
+                    parity += 1
+
         def changelist(**map):
             parity = 0
             cl = self.repo.changelog
@@ -540,6 +562,7 @@ class hgweb(object):
                           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"))
diff -r b9a7c07fca0e -r 627a3852ee22 templates/gitweb/summary.tmpl
--- a/templates/gitweb/summary.tmpl	Thu Oct 12 14:19:34 2006 -0700
+++ b/templates/gitweb/summary.tmpl	Thu Oct 12 15:34:52 2006 -0700
@@ -36,4 +36,12 @@ summary |
 <tr class="light"><td colspan="3"><a class="list" href="{url}tags{sessionvars%urlparameter}">...</a></td></tr>
 </table>
 
+<div><a class="title"
+href="{url}tags{sessionvars%urlparameter}">heads</a></div>
+<table cellspacing="0">
+{heads}
+<tr class="light">
+  <td colspan="3"><a class="list"  href="{url}tags{sessionvars%urlparameter}">...</a></td>
+</tr>
+</table>
 #footer#



More information about the Mercurial-devel mailing list