--- a/mercurial/hgweb/webcommands.py Sat Mar 12 11:19:44 2011 +0100
+++ b/mercurial/hgweb/webcommands.py Sat Mar 12 11:20:03 2011 +0100
@@ -21,8 +21,8 @@
__all__ = [
'log', 'rawfile', 'file', 'changelog', 'shortlog', 'changeset', 'rev',
- 'manifest', 'tags', 'branches', 'summary', 'filediff', 'diff', 'annotate',
- 'filelog', 'archive', 'static', 'graph', 'help',
+ 'manifest', 'tags', 'bookmarks', 'branches', 'summary', 'filediff', 'diff',
+ 'annotate', 'filelog', 'archive', 'static', 'graph', 'help',
]
def log(web, req, tmpl):
@@ -389,6 +389,30 @@
entriesnotip=lambda **x: entries(True, 0, **x),
latestentry=lambda **x: entries(True, 1, **x))
+def bookmarks(web, req, tmpl):
+ i = web.repo._bookmarks.items()
+ i.reverse()
+ parity = paritygen(web.stripecount)
+
+ def entries(notip=False, limit=0, **map):
+ count = 0
+ for k, n in i:
+ if notip and k == "tip":
+ continue
+ if limit > 0 and count >= limit:
+ continue
+ count = count + 1
+ yield {"parity": parity.next(),
+ "bookmark": k,
+ "date": web.repo[n].date(),
+ "node": hex(n)}
+
+ return tmpl("bookmarks",
+ node=hex(web.repo.changelog.tip()),
+ entries=lambda **x: entries(False, 0, **x),
+ entriesnotip=lambda **x: entries(True, 0, **x),
+ latestentry=lambda **x: entries(True, 1, **x))
+
def branches(web, req, tmpl):
tips = (web.repo[n] for t, n in web.repo.branchtags().iteritems())
heads = web.repo.heads()
@@ -726,7 +750,8 @@
user = cgi.escape(templatefilters.person(ctx.user()))
branch = ctx.branch()
branch = branch, web.repo.branchtags().get(branch) == ctx.node()
- data.append((node, vtx, edges, desc, user, age, branch, ctx.tags(), ctx.bookmarks()))
+ data.append((node, vtx, edges, desc, user, age, branch, ctx.tags(),
+ ctx.bookmarks()))
return tmpl('graph', rev=rev, revcount=revcount, uprev=uprev,
lessvars=lessvars, morevars=morevars, downrev=downrev,