mercurial/hgweb/webcommands.py
changeset 8796 2bcef677a6c3
parent 8713 de6bb29e208a
child 8842 acd03a6e2426
equal deleted inserted replaced
8795:51c29aec0b75 8796:2bcef677a6c3
   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     tips = (web.repo[n] for t, n in web.repo.branchtags().iteritems())
   363     tips = (web.repo[n] for t, n in web.repo.branchtags().iteritems())
   364     open = set(web.repo[n].branch() for n in web.repo.heads(closed=False))
   364     heads = web.repo.heads()
   365     parity = paritygen(web.stripecount)
   365     parity = paritygen(web.stripecount)
   366     sortkey = lambda ctx: ('close' not in ctx.extra(), ctx.rev())
   366     sortkey = lambda ctx: ('close' not in ctx.extra(), ctx.rev())
   367 
   367 
   368     def entries(limit, **map):
   368     def entries(limit, **map):
   369         count = 0
   369         count = 0
   370         for ctx in sorted(tips, key=sortkey, reverse=True):
   370         for ctx in sorted(tips, key=sortkey, reverse=True):
   371             if limit > 0 and count >= limit:
   371             if limit > 0 and count >= limit:
   372                 return
   372                 return
   373             count += 1
   373             count += 1
   374             status = ctx.branch() in open and 'open' or 'closed'
   374             if ctx.node() not in heads:
       
   375                 status = 'inactive'
       
   376             elif not web.repo.branchheads(ctx.branch()):
       
   377                 status = 'closed'
       
   378             else:
       
   379                 status = 'open'
   375             yield {'parity': parity.next(),
   380             yield {'parity': parity.next(),
   376                    'branch': ctx.branch(),
   381                    'branch': ctx.branch(),
   377                    'status': status,
   382                    'status': status,
   378                    'node': ctx.hex(),
   383                    'node': ctx.hex(),
   379                    'date': ctx.date()}
   384                    'date': ctx.date()}