diff --git a/mercurial/hgweb/webcommands.py b/mercurial/hgweb/webcommands.py --- a/mercurial/hgweb/webcommands.py +++ b/mercurial/hgweb/webcommands.py @@ -21,8 +21,8 @@ from mercurial.i18n import _ __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 @@ def tags(web, req, tmpl): 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 @@ def graph(web, req, tmpl): 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, diff --git a/mercurial/templates/paper/bookmarks.tmpl b/mercurial/templates/paper/bookmarks.tmpl new file mode 100644 --- /dev/null +++ b/mercurial/templates/paper/bookmarks.tmpl @@ -0,0 +1,49 @@ +{header} +{repo|escape}: bookmarks + + + + + +
+ + +
+

{repo|escape}

+

bookmarks

+ + + + + + + + +{entries%bookmarkentry} +
bookmarknode
+
+
+ +{footer} diff --git a/mercurial/templates/paper/branches.tmpl b/mercurial/templates/paper/branches.tmpl --- a/mercurial/templates/paper/branches.tmpl +++ b/mercurial/templates/paper/branches.tmpl @@ -17,6 +17,7 @@
  • log
  • graph
  • tags
  • +
  • bookmarks
  • branches
  • diff --git a/mercurial/templates/paper/fileannotate.tmpl b/mercurial/templates/paper/fileannotate.tmpl --- a/mercurial/templates/paper/fileannotate.tmpl +++ b/mercurial/templates/paper/fileannotate.tmpl @@ -13,6 +13,7 @@
  • log
  • graph
  • tags
  • +
  • bookmarks
  • branches
  • diff --git a/mercurial/templates/paper/filediff.tmpl b/mercurial/templates/paper/filediff.tmpl --- a/mercurial/templates/paper/filediff.tmpl +++ b/mercurial/templates/paper/filediff.tmpl @@ -13,6 +13,7 @@
  • log
  • graph
  • tags
  • +
  • bookmarks
  • branches
  • diff --git a/mercurial/templates/paper/shortlog.tmpl b/mercurial/templates/paper/shortlog.tmpl --- a/mercurial/templates/paper/shortlog.tmpl +++ b/mercurial/templates/paper/shortlog.tmpl @@ -17,6 +17,7 @@
  • log
  • graph
  • tags
  • +
  • bookmarks
  • branches
  • diff --git a/tests/test-hgweb-descend-empties.t b/tests/test-hgweb-descend-empties.t --- a/tests/test-hgweb-descend-empties.t +++ b/tests/test-hgweb-descend-empties.t @@ -51,6 +51,7 @@ manifest with descending
  • log
  • graph
  • tags
  • +
  • bookmarks
  • branches
  • diff --git a/tests/test-hgweb-removed.t b/tests/test-hgweb-removed.t --- a/tests/test-hgweb-removed.t +++ b/tests/test-hgweb-removed.t @@ -38,6 +38,7 @@ revision
  • log
  • graph
  • tags
  • +
  • bookmarks
  • branches
  • @@ -147,6 +148,7 @@ should give a 404 - file does not exist
  • log
  • graph
  • tags
  • +
  • bookmarks
  • branches
  • help
  • @@ -214,6 +216,7 @@ try bad style
  • log
  • graph
  • tags
  • +
  • bookmarks
  • branches