Mercurial > public > mercurial-scm > hg-stable
diff mercurial/hgweb/webcommands.py @ 26129:a103ecb8a04a
hgweb: move branchentries code from webcommands to webutil
author | Anton Shestakov <av6@dwimlabs.net> |
---|---|
date | Tue, 01 Sep 2015 22:28:45 +0800 |
parents | 328739ea70c3 |
children | e466c15597a3 |
line wrap: on
line diff
--- a/mercurial/hgweb/webcommands.py Tue Aug 18 22:15:46 2015 +0900 +++ b/mercurial/hgweb/webcommands.py Tue Sep 01 22:28:45 2015 +0800 @@ -639,35 +639,10 @@ The ``branches`` template is rendered. """ - tips = [] - heads = web.repo.heads() - parity = paritygen(web.stripecount) - sortkey = lambda item: (not item[1], item[0].rev()) - - def entries(limit, **map): - count = 0 - if not tips: - for tag, hs, tip, closed in web.repo.branchmap().iterbranches(): - tips.append((web.repo[tip], closed)) - for ctx, closed in sorted(tips, key=sortkey, reverse=True): - if limit > 0 and count >= limit: - return - count += 1 - if closed: - status = 'closed' - elif ctx.node() not in heads: - status = 'inactive' - else: - status = 'open' - yield {'parity': parity.next(), - 'branch': ctx.branch(), - 'status': status, - 'node': ctx.hex(), - 'date': ctx.date()} - + entries = webutil.branchentries(web.repo, web.stripecount) + latestentry = webutil.branchentries(web.repo, web.stripecount, 1) return tmpl('branches', node=hex(web.repo.changelog.tip()), - entries=lambda **x: entries(0, **x), - latestentry=lambda **x: entries(1, **x)) + entries=entries, latestentry=latestentry) @webcommand('summary') def summary(web, req, tmpl):