diff mercurial/hgweb/webcommands.py @ 13924:ea726c97c1b6

hgweb: add bookmarks listing to summary page of gitweb/monoblue styles
author Yuya Nishihara <yuya@tcha.org>
date Sun, 10 Apr 2011 10:01:42 +0900
parents 2176c5babd53
children c3372529247f
line wrap: on
line diff
--- a/mercurial/hgweb/webcommands.py	Sun Apr 10 10:01:39 2011 +0900
+++ b/mercurial/hgweb/webcommands.py	Sun Apr 10 10:01:42 2011 +0900
@@ -460,6 +460,15 @@
                        node=hex(n),
                        date=web.repo[n].date())
 
+    def bookmarks(**map):
+        parity = paritygen(web.stripecount)
+        b = web.repo._bookmarks.items()
+        for k, n in sorted(b)[:10]:  # limit to 10 bookmarks
+            yield {'parity': parity.next(),
+                   'bookmark': k,
+                   'date': web.repo[n].date(),
+                   'node': hex(n)}
+
     def branches(**map):
         parity = paritygen(web.stripecount)
 
@@ -504,6 +513,7 @@
                 owner=get_contact(web.config) or "unknown",
                 lastchange=tip.date(),
                 tags=tagentries,
+                bookmarks=bookmarks,
                 branches=branches,
                 shortlog=changelist,
                 node=tip.hex(),