diff mercurial/hgweb/webcommands.py @ 8713:de6bb29e208a

hgweb: allow distinction between open/closed branches on branches page
author Dirkjan Ochtman <dirkjan@ochtman.nl>
date Thu, 04 Jun 2009 18:05:50 +0200
parents beae42f3d93b
children 2bcef677a6c3
line wrap: on
line diff
--- a/mercurial/hgweb/webcommands.py	Wed Jun 03 17:12:48 2009 -0500
+++ b/mercurial/hgweb/webcommands.py	Thu Jun 04 18:05:50 2009 +0200
@@ -361,16 +361,20 @@
 def branches(web, req, tmpl):
     b = web.repo.branchtags()
     tips = (web.repo[n] for t, n in web.repo.branchtags().iteritems())
+    open = set(web.repo[n].branch() for n in web.repo.heads(closed=False))
     parity = paritygen(web.stripecount)
+    sortkey = lambda ctx: ('close' not in ctx.extra(), ctx.rev())
 
     def entries(limit, **map):
         count = 0
-        for ctx in sorted(tips, key=lambda x: x.rev(), reverse=True):
+        for ctx in sorted(tips, key=sortkey, reverse=True):
             if limit > 0 and count >= limit:
                 return
             count += 1
+            status = ctx.branch() in open and 'open' or 'closed'
             yield {'parity': parity.next(),
                    'branch': ctx.branch(),
+                   'status': status,
                    'node': ctx.hex(),
                    'date': ctx.date()}