# HG changeset patch # User Alexander Solovyov # Date 2011-03-12 10:19:44 # Node ID 270f57d3552581c6f64c64de78d164ea618e3f24 # Parent 64a458707fd413709a9cae49a87c722795a6a641 hgweb: add display of bookmarks for changelog and changeset diff --git a/mercurial/hgweb/webcommands.py b/mercurial/hgweb/webcommands.py --- a/mercurial/hgweb/webcommands.py +++ b/mercurial/hgweb/webcommands.py @@ -205,6 +205,7 @@ def changelog(web, req, tmpl, shortlog=F "rev": i, "node": hex(n), "tags": webutil.nodetagsdict(web.repo, n), + "bookmarks": webutil.nodebookmarksdict(web.repo, n), "inbranch": webutil.nodeinbranch(web.repo, ctx), "branches": webutil.nodebranchdict(web.repo, ctx) }) @@ -247,6 +248,8 @@ def shortlog(web, req, tmpl): def changeset(web, req, tmpl): ctx = webutil.changectx(web.repo, req) showtags = webutil.showtag(web.repo, tmpl, 'changesettag', ctx.node()) + showbookmarks = webutil.showbookmark(web.repo, tmpl, 'changesetbookmark', + ctx.node()) showbranch = webutil.nodebranchnodefault(ctx) files = [] @@ -270,6 +273,7 @@ def changeset(web, req, tmpl): parent=webutil.parents(ctx), child=webutil.children(ctx), changesettag=showtags, + changesetbookmark=showbookmarks, changesetbranch=showbranch, author=ctx.user(), desc=ctx.description(), @@ -277,6 +281,7 @@ def changeset(web, req, tmpl): files=files, archives=web.archivelist(ctx.hex()), tags=webutil.nodetagsdict(web.repo, ctx.node()), + bookmarks=webutil.nodebookmarksdict(web.repo, ctx.node()), branch=webutil.nodebranchnodefault(ctx), inbranch=webutil.nodeinbranch(web.repo, ctx), branches=webutil.nodebranchdict(web.repo, ctx)) @@ -721,7 +726,7 @@ 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())) + 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/hgweb/webutil.py b/mercurial/hgweb/webutil.py --- a/mercurial/hgweb/webutil.py +++ b/mercurial/hgweb/webutil.py @@ -90,6 +90,9 @@ def renamelink(fctx): def nodetagsdict(repo, node): return [{"name": i} for i in repo.nodetags(node)] +def nodebookmarksdict(repo, node): + return [{"name": i} for i in repo.nodebookmarks(node)] + def nodebranchdict(repo, ctx): branches = [] branch = ctx.branch() @@ -118,6 +121,10 @@ def showtag(repo, tmpl, t1, node=nullid, for t in repo.nodetags(node): yield tmpl(t1, tag=t, **args) +def showbookmark(repo, tmpl, t1, node=nullid, **args): + for t in repo.nodebookmarks(node): + yield tmpl(t1, bookmark=t, **args) + def cleanpath(repo, path): path = path.lstrip('/') return util.canonpath(repo.root, '', path) diff --git a/mercurial/templates/paper/changeset.tmpl b/mercurial/templates/paper/changeset.tmpl --- a/mercurial/templates/paper/changeset.tmpl +++ b/mercurial/templates/paper/changeset.tmpl @@ -30,7 +30,7 @@

{repo|escape}

-

changeset {rev}:{node|short} {changesetbranch%changelogbranchname} {changesettag}

+

changeset {rev}:{node|short} {changesetbranch%changelogbranchname} {changesettag} {changesetbookmark}