mercurial/hgweb/webcommands.py
changeset 8354 418ea63f00fb
parent 8352 eefcb59d44d6
child 8390 beae42f3d93b
equal deleted inserted replaced
8353:6058d291abdf 8354:418ea63f00fb
   358                 entriesnotip=lambda **x: entries(True,0, **x),
   358                 entriesnotip=lambda **x: entries(True,0, **x),
   359                 latestentry=lambda **x: entries(True,1, **x))
   359                 latestentry=lambda **x: entries(True,1, **x))
   360 
   360 
   361 def branches(web, req, tmpl):
   361 def branches(web, req, tmpl):
   362     b = web.repo.branchtags()
   362     b = web.repo.branchtags()
   363     l = [(-web.repo.changelog.rev(n), n, t) for t, n in b.iteritems()]
   363     tips = (web.repo[n] for t, n in web.repo.branchtags().iteritems())
   364     parity = paritygen(web.stripecount)
   364     parity = paritygen(web.stripecount)
   365 
   365 
   366     def entries(limit, **map):
   366     def entries(limit, **map):
   367         count = 0
   367         count = 0
   368         for r, n, t in sorted(l):
   368         for ctx in sorted(tips, key=lambda x: x.rev(), reverse=True):
   369             if limit > 0 and count >= limit:
   369             if limit > 0 and count >= limit:
   370                 return
   370                 return
   371             count += 1
   371             count += 1
   372             yield {'parity': parity.next(),
   372             yield {'parity': parity.next(),
   373                    'branch': t,
   373                    'branch': ctx.branch(),
   374                    'node': hex(n),
   374                    'node': ctx.hex(),
   375                    'date': web.repo[n].date()}
   375                    'date': ctx.date()}
   376 
   376 
   377     return tmpl('branches', node=hex(web.repo.changelog.tip()),
   377     return tmpl('branches', node=hex(web.repo.changelog.tip()),
   378                 entries=lambda **x: entries(0, **x),
   378                 entries=lambda **x: entries(0, **x),
   379                 latestentry=lambda **x: entries(1, **x))
   379                 latestentry=lambda **x: entries(1, **x))
   380 
   380