Mercurial > hg
changeset 8352:eefcb59d44d6
webcommands: add 'branches' command, similar to 'tags'
author | Sune Foldager <cryo@cyanite.org> |
---|---|
date | Tue, 12 May 2009 09:43:36 +0200 |
parents | f28c2f8b9969 |
children | 6058d291abdf |
files | mercurial/hgweb/webcommands.py |
diffstat | 1 files changed, 22 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/hgweb/webcommands.py Tue May 12 11:27:26 2009 +0200 +++ b/mercurial/hgweb/webcommands.py Tue May 12 09:43:36 2009 +0200 @@ -19,8 +19,8 @@ __all__ = [ 'log', 'rawfile', 'file', 'changelog', 'shortlog', 'changeset', 'rev', - 'manifest', 'tags', 'summary', 'filediff', 'diff', 'annotate', 'filelog', - 'archive', 'static', 'graph', + 'manifest', 'tags', 'branches', 'summary', 'filediff', 'diff', 'annotate', + 'filelog', 'archive', 'static', 'graph', ] def log(web, req, tmpl): @@ -358,6 +358,26 @@ entriesnotip=lambda **x: entries(True,0, **x), latestentry=lambda **x: entries(True,1, **x)) +def branches(web, req, tmpl): + b = web.repo.branchtags() + l = [(-web.repo.changelog.rev(n), n, t) for t, n in b.iteritems()] + parity = paritygen(web.stripecount) + + def entries(limit, **map): + count = 0 + for r, n, t in sorted(l): + if limit > 0 and count >= limit: + return + count += 1 + yield {'parity': parity.next(), + 'branch': t, + 'node': hex(n), + 'date': web.repo[n].date()} + + return tmpl('branches', node=hex(web.repo.changelog.tip()), + entries=lambda **x: entries(0, **x), + latestentry=lambda **x: entries(1, **x)) + def summary(web, req, tmpl): i = web.repo.tagslist() i.reverse()