changeset 8354:418ea63f00fb

hgweb: use context api in branches webcommand
author Dirkjan Ochtman <dirkjan@ochtman.nl>
date Tue, 12 May 2009 10:23:45 +0200
parents 6058d291abdf
children 5ba798f339c8
files mercurial/hgweb/webcommands.py
diffstat 1 files changed, 5 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/hgweb/webcommands.py	Tue May 12 12:00:54 2009 +0200
+++ b/mercurial/hgweb/webcommands.py	Tue May 12 10:23:45 2009 +0200
@@ -360,19 +360,19 @@
 
 def branches(web, req, tmpl):
     b = web.repo.branchtags()
-    l = [(-web.repo.changelog.rev(n), n, t) for t, n in b.iteritems()]
+    tips = (web.repo[n] for t, n in web.repo.branchtags().iteritems())
     parity = paritygen(web.stripecount)
 
     def entries(limit, **map):
         count = 0
-        for r, n, t in sorted(l):
+        for ctx in sorted(tips, key=lambda x: x.rev(), reverse=True):
             if limit > 0 and count >= limit:
                 return
             count += 1
             yield {'parity': parity.next(),
-                   'branch': t,
-                   'node': hex(n),
-                   'date': web.repo[n].date()}
+                   'branch': ctx.branch(),
+                   'node': ctx.hex(),
+                   'date': ctx.date()}
 
     return tmpl('branches', node=hex(web.repo.changelog.tip()),
                 entries=lambda **x: entries(0, **x),