Mercurial > hg
changeset 13597:38c9837b1f75 stable
hgweb: add separate page with bookmarks listing
line wrap: on
line diff
--- 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,
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mercurial/templates/paper/bookmarks.tmpl Sat Mar 12 11:20:03 2011 +0100 @@ -0,0 +1,49 @@ +{header} +<title>{repo|escape}: bookmarks</title> +<link rel="alternate" type="application/atom+xml" + href="{url}atom-bookmarks" title="Atom feed for {repo|escape}: bookmarks" /> +<link rel="alternate" type="application/rss+xml" + href="{url}rss-bookmarks" title="RSS feed for {repo|escape}: bookmarks" /> +</head> +<body> + +<div class="container"> +<div class="menu"> +<div class="logo"> +<a href="http://mercurial.selenic.com/"> +<img src="{staticurl}hglogo.png" alt="mercurial" /></a> +</div> +<ul> +<li><a href="{url}shortlog{sessionvars%urlparameter}">log</a></li> +<li><a href="{url}graph{sessionvars%urlparameter}">graph</a></li> +<li><a href="{url}tags{sessionvars%urlparameter}">tags</a></li> +<li class="active">bookmarks</li> +<li><a href="{url}branches{sessionvars%urlparameter}">branches</a></li> +</ul> +<ul> +<li><a href="{url}help{sessionvars%urlparameter}">help</a></li> +</ul> +</div> + +<div class="main"> +<h2><a href="{url}{sessionvars%urlparameter}">{repo|escape}</a></h2> +<h3>bookmarks</h3> + +<form class="search" action="{url}log"> +{sessionvars%hiddenformentry} +<p><input name="rev" id="search1" type="text" size="30" /></p> +<div id="hint">find changesets by author, revision, +files, or words in the commit message</div> +</form> + +<table class="bigtable"> +<tr> + <th>bookmark</th> + <th>node</th> +</tr> +{entries%bookmarkentry} +</table> +</div> +</div> + +{footer}
--- a/mercurial/templates/paper/branches.tmpl Sat Mar 12 11:19:44 2011 +0100 +++ b/mercurial/templates/paper/branches.tmpl Sat Mar 12 11:20:03 2011 +0100 @@ -17,6 +17,7 @@ <li><a href="{url}shortlog{sessionvars%urlparameter}">log</a></li> <li><a href="{url}graph{sessionvars%urlparameter}">graph</a></li> <li><a href="{url}tags{sessionvars%urlparameter}">tags</a></li> +<li><a href="{url}bookmarks{sessionvars%urlparameter}">bookmarks</a></li> <li class="active">branches</li> </ul> <ul>
--- a/mercurial/templates/paper/changeset.tmpl Sat Mar 12 11:19:44 2011 +0100 +++ b/mercurial/templates/paper/changeset.tmpl Sat Mar 12 11:20:03 2011 +0100 @@ -12,6 +12,7 @@ <li><a href="{url}shortlog/{node|short}{sessionvars%urlparameter}">log</a></li> <li><a href="{url}graph/{node|short}{sessionvars%urlparameter}">graph</a></li> <li><a href="{url}tags{sessionvars%urlparameter}">tags</a></li> + <li><a href="{url}bookmarks{sessionvars%urlparameter}">bookmarks</a></li> <li><a href="{url}branches{sessionvars%urlparameter}">branches</a></li> </ul> <ul>
--- a/mercurial/templates/paper/error.tmpl Sat Mar 12 11:19:44 2011 +0100 +++ b/mercurial/templates/paper/error.tmpl Sat Mar 12 11:20:03 2011 +0100 @@ -13,6 +13,7 @@ <li><a href="{url}shortlog{sessionvars%urlparameter}">log</a></li> <li><a href="{url}graph{sessionvars%urlparameter}">graph</a></li> <li><a href="{url}tags{sessionvars%urlparameter}">tags</a></li> +<li><a href="{url}bookmarks{sessionvars%urlparameter}">bookmarks</a></li> <li><a href="{url}branches{sessionvars%urlparameter}">branches</a></li> <li><a href="{url}help{sessionvars%urlparameter}">help</a></li> </ul>
--- a/mercurial/templates/paper/fileannotate.tmpl Sat Mar 12 11:19:44 2011 +0100 +++ b/mercurial/templates/paper/fileannotate.tmpl Sat Mar 12 11:20:03 2011 +0100 @@ -13,6 +13,7 @@ <li><a href="{url}shortlog/{node|short}{sessionvars%urlparameter}">log</a></li> <li><a href="{url}graph/{node|short}{sessionvars%urlparameter}">graph</a></li> <li><a href="{url}tags{sessionvars%urlparameter}">tags</a></li> +<li><a href="{url}bookmarks{sessionvars%urlparameter}">bookmarks</a></li> <li><a href="{url}branches{sessionvars%urlparameter}">branches</a></li> </ul>
--- a/mercurial/templates/paper/filediff.tmpl Sat Mar 12 11:19:44 2011 +0100 +++ b/mercurial/templates/paper/filediff.tmpl Sat Mar 12 11:20:03 2011 +0100 @@ -13,6 +13,7 @@ <li><a href="{url}shortlog/{node|short}{sessionvars%urlparameter}">log</a></li> <li><a href="{url}graph/{node|short}{sessionvars%urlparameter}">graph</a></li> <li><a href="{url}tags{sessionvars%urlparameter}">tags</a></li> +<li><a href="{url}bookmarks{sessionvars%urlparameter}">bookmarks</a></li> <li><a href="{url}branches{sessionvars%urlparameter}">branches</a></li> </ul> <ul>
--- a/mercurial/templates/paper/filelog.tmpl Sat Mar 12 11:19:44 2011 +0100 +++ b/mercurial/templates/paper/filelog.tmpl Sat Mar 12 11:20:03 2011 +0100 @@ -17,6 +17,7 @@ <li><a href="{url}shortlog/{node|short}{sessionvars%urlparameter}">log</a></li> <li><a href="{url}graph/{node|short}{sessionvars%urlparameter}">graph</a></li> <li><a href="{url}tags{sessionvars%urlparameter}">tags</a></li> +<li><a href="{url}bookmarks{sessionvars%urlparameter}">bookmarks</a></li> <li><a href="{url}branches{sessionvars%urlparameter}">branches</a></li> </ul> <ul>
--- a/mercurial/templates/paper/graph.tmpl Sat Mar 12 11:19:44 2011 +0100 +++ b/mercurial/templates/paper/graph.tmpl Sat Mar 12 11:20:03 2011 +0100 @@ -18,6 +18,7 @@ <li><a href="{url}shortlog/{node|short}{sessionvars%urlparameter}">log</a></li> <li class="active">graph</li> <li><a href="{url}tags{sessionvars%urlparameter}">tags</a></li> +<li><a href="{url}bookmarks{sessionvars%urlparameter}">bookmarks</a></li> <li><a href="{url}branches{sessionvars%urlparameter}">branches</a></li> </ul> <ul>
--- a/mercurial/templates/paper/help.tmpl Sat Mar 12 11:19:44 2011 +0100 +++ b/mercurial/templates/paper/help.tmpl Sat Mar 12 11:20:03 2011 +0100 @@ -17,6 +17,7 @@ <li><a href="{url}shortlog{sessionvars%urlparameter}">log</a></li> <li><a href="{url}graph{sessionvars%urlparameter}">graph</a></li> <li><a href="{url}tags{sessionvars%urlparameter}">tags</a></li> +<li><a href="{url}bookmarks{sessionvars%urlparameter}">bookmarks</a></li> <li><a href="{url}branches{sessionvars%urlparameter}">branches</a></li> </ul> <ul>
--- a/mercurial/templates/paper/helptopics.tmpl Sat Mar 12 11:19:44 2011 +0100 +++ b/mercurial/templates/paper/helptopics.tmpl Sat Mar 12 11:20:03 2011 +0100 @@ -17,6 +17,7 @@ <li><a href="{url}shortlog{sessionvars%urlparameter}">log</a></li> <li><a href="{url}graph{sessionvars%urlparameter}">graph</a></li> <li><a href="{url}tags{sessionvars%urlparameter}">tags</a></li> +<li><a href="{url}bookmarks{sessionvars%urlparameter}">bookmarks</a></li> <li><a href="{url}branches{sessionvars%urlparameter}">branches</a></li> </ul> <ul>
--- a/mercurial/templates/paper/manifest.tmpl Sat Mar 12 11:19:44 2011 +0100 +++ b/mercurial/templates/paper/manifest.tmpl Sat Mar 12 11:20:03 2011 +0100 @@ -13,6 +13,7 @@ <li><a href="{url}shortlog/{node|short}{sessionvars%urlparameter}">log</a></li> <li><a href="{url}graph/{node|short}{sessionvars%urlparameter}">graph</a></li> <li><a href="{url}tags{sessionvars%urlparameter}">tags</a></li> +<li><a href="{url}bookmarks{sessionvars%urlparameter}">bookmarks</a></li> <li><a href="{url}branches{sessionvars%urlparameter}">branches</a></li> </ul> <ul>
--- a/mercurial/templates/paper/map Sat Mar 12 11:19:44 2011 +0100 +++ b/mercurial/templates/paper/map Sat Mar 12 11:20:03 2011 +0100 @@ -141,6 +141,18 @@ {node|short} </td> </tr>' +bookmarks = bookmarks.tmpl +bookmarkentry = ' + <tr class="tagEntry parity{parity}"> + <td> + <a href="{url}rev/{node|short}{sessionvars%urlparameter}"> + {bookmark|escape} + </a> + </td> + <td class="node"> + {node|short} + </td> + </tr>' branches = branches.tmpl branchentry = ' <tr class="tagEntry parity{parity}">
--- a/mercurial/templates/paper/search.tmpl Sat Mar 12 11:19:44 2011 +0100 +++ b/mercurial/templates/paper/search.tmpl Sat Mar 12 11:20:03 2011 +0100 @@ -13,6 +13,7 @@ <li><a href="{url}shortlog{sessionvars%urlparameter}">log</a></li> <li><a href="{url}graph{sessionvars%urlparameter}">graph</a></li> <li><a href="{url}tags{sessionvars%urlparameter}">tags</a></li> +<li><a href="{url}bookmarks{sessionvars%urlparameter}">bookmarks</a></li> <li><a href="{url}branches{sessionvars%urlparameter}">branches</a></li> <li><a href="{url}help{sessionvars%urlparameter}">help</a></li> </ul>
--- a/mercurial/templates/paper/shortlog.tmpl Sat Mar 12 11:19:44 2011 +0100 +++ b/mercurial/templates/paper/shortlog.tmpl Sat Mar 12 11:20:03 2011 +0100 @@ -17,6 +17,7 @@ <li class="active">log</li> <li><a href="{url}graph/{node|short}{sessionvars%urlparameter}">graph</a></li> <li><a href="{url}tags{sessionvars%urlparameter}">tags</a></li> +<li><a href="{url}bookmarks{sessionvars%urlparameter}">bookmarks</a></li> <li><a href="{url}branches{sessionvars%urlparameter}">branches</a></li> </ul> <ul>
--- a/mercurial/templates/paper/tags.tmpl Sat Mar 12 11:19:44 2011 +0100 +++ b/mercurial/templates/paper/tags.tmpl Sat Mar 12 11:20:03 2011 +0100 @@ -17,6 +17,7 @@ <li><a href="{url}shortlog{sessionvars%urlparameter}">log</a></li> <li><a href="{url}graph{sessionvars%urlparameter}">graph</a></li> <li class="active">tags</li> +<li><a href="{url}bookmarks{sessionvars%urlparameter}">bookmarks</a></li> <li><a href="{url}branches{sessionvars%urlparameter}">branches</a></li> </ul> <ul>
--- a/tests/test-hgweb-commands.t Sat Mar 12 11:19:44 2011 +0100 +++ b/tests/test-hgweb-commands.t Sat Mar 12 11:20:03 2011 +0100 @@ -205,6 +205,7 @@ <li class="active">log</li> <li><a href="/graph/1d22e65f027e">graph</a></li> <li><a href="/tags">tags</a></li> + <li><a href="/bookmarks">bookmarks</a></li> <li><a href="/branches">branches</a></li> </ul> <ul> @@ -297,6 +298,7 @@ <li><a href="/shortlog/2ef0ac749a14">log</a></li> <li><a href="/graph/2ef0ac749a14">graph</a></li> <li><a href="/tags">tags</a></li> + <li><a href="/bookmarks">bookmarks</a></li> <li><a href="/branches">branches</a></li> </ul> <ul> @@ -410,6 +412,7 @@ <li><a href="/shortlog">log</a></li> <li><a href="/graph">graph</a></li> <li><a href="/tags">tags</a></li> + <li><a href="/bookmarks">bookmarks</a></li> <li><a href="/branches">branches</a></li> <li><a href="/help">help</a></li> </ul>
--- a/tests/test-hgweb-descend-empties.t Sat Mar 12 11:19:44 2011 +0100 +++ b/tests/test-hgweb-descend-empties.t Sat Mar 12 11:20:03 2011 +0100 @@ -51,6 +51,7 @@ <li><a href="/shortlog/9087c84a0f5d">log</a></li> <li><a href="/graph/9087c84a0f5d">graph</a></li> <li><a href="/tags">tags</a></li> + <li><a href="/bookmarks">bookmarks</a></li> <li><a href="/branches">branches</a></li> </ul> <ul>
--- a/tests/test-hgweb-diffs.t Sat Mar 12 11:19:44 2011 +0100 +++ b/tests/test-hgweb-diffs.t Sat Mar 12 11:20:03 2011 +0100 @@ -43,6 +43,7 @@ <li><a href="/shortlog/0cd96de13884">log</a></li> <li><a href="/graph/0cd96de13884">graph</a></li> <li><a href="/tags">tags</a></li> + <li><a href="/bookmarks">bookmarks</a></li> <li><a href="/branches">branches</a></li> </ul> <ul> @@ -167,6 +168,7 @@ <li><a href="/shortlog/78e4ebad7cdf">log</a></li> <li><a href="/graph/78e4ebad7cdf">graph</a></li> <li><a href="/tags">tags</a></li> + <li><a href="/bookmarks">bookmarks</a></li> <li><a href="/branches">branches</a></li> </ul> <ul> @@ -268,6 +270,7 @@ <li><a href="/shortlog/0cd96de13884">log</a></li> <li><a href="/graph/0cd96de13884">graph</a></li> <li><a href="/tags">tags</a></li> + <li><a href="/bookmarks">bookmarks</a></li> <li><a href="/branches">branches</a></li> </ul> <ul> @@ -396,6 +399,7 @@ <li><a href="/shortlog/78e4ebad7cdf">log</a></li> <li><a href="/graph/78e4ebad7cdf">graph</a></li> <li><a href="/tags">tags</a></li> + <li><a href="/bookmarks">bookmarks</a></li> <li><a href="/branches">branches</a></li> </ul> <ul>
--- a/tests/test-hgweb-empty.t Sat Mar 12 11:19:44 2011 +0100 +++ b/tests/test-hgweb-empty.t Sat Mar 12 11:20:03 2011 +0100 @@ -32,6 +32,7 @@ <li class="active">log</li> <li><a href="/graph/000000000000">graph</a></li> <li><a href="/tags">tags</a></li> + <li><a href="/bookmarks">bookmarks</a></li> <li><a href="/branches">branches</a></li> </ul> <ul> @@ -114,6 +115,7 @@ <li class="active">log</li> <li><a href="/graph/000000000000">graph</a></li> <li><a href="/tags">tags</a></li> + <li><a href="/bookmarks">bookmarks</a></li> <li><a href="/branches">branches</a></li> </ul> <ul> @@ -197,6 +199,7 @@ <li><a href="/shortlog/000000000000">log</a></li> <li class="active">graph</li> <li><a href="/tags">tags</a></li> + <li><a href="/bookmarks">bookmarks</a></li> <li><a href="/branches">branches</a></li> </ul> <ul> @@ -346,6 +349,7 @@ <li><a href="/shortlog/000000000000">log</a></li> <li><a href="/graph/000000000000">graph</a></li> <li><a href="/tags">tags</a></li> + <li><a href="/bookmarks">bookmarks</a></li> <li><a href="/branches">branches</a></li> </ul> <ul>
--- a/tests/test-hgweb-filelog.t Sat Mar 12 11:19:44 2011 +0100 +++ b/tests/test-hgweb-filelog.t Sat Mar 12 11:20:03 2011 +0100 @@ -136,6 +136,7 @@ <li><a href="/shortlog/01de2d66a28d">log</a></li> <li><a href="/graph/01de2d66a28d">graph</a></li> <li><a href="/tags">tags</a></li> + <li><a href="/bookmarks">bookmarks</a></li> <li><a href="/branches">branches</a></li> </ul> <ul> @@ -234,6 +235,7 @@ <li><a href="/shortlog/01de2d66a28d">log</a></li> <li><a href="/graph/01de2d66a28d">graph</a></li> <li><a href="/tags">tags</a></li> + <li><a href="/bookmarks">bookmarks</a></li> <li><a href="/branches">branches</a></li> </ul> <ul> @@ -332,6 +334,7 @@ <li><a href="/shortlog/5ed941583260">log</a></li> <li><a href="/graph/5ed941583260">graph</a></li> <li><a href="/tags">tags</a></li> + <li><a href="/bookmarks">bookmarks</a></li> <li><a href="/branches">branches</a></li> </ul> <ul> @@ -425,6 +428,7 @@ <li><a href="/shortlog/5ed941583260">log</a></li> <li><a href="/graph/5ed941583260">graph</a></li> <li><a href="/tags">tags</a></li> + <li><a href="/bookmarks">bookmarks</a></li> <li><a href="/branches">branches</a></li> </ul> <ul> @@ -514,6 +518,7 @@ <li><a href="/shortlog">log</a></li> <li><a href="/graph">graph</a></li> <li><a href="/tags">tags</a></li> + <li><a href="/bookmarks">bookmarks</a></li> <li><a href="/branches">branches</a></li> <li><a href="/help">help</a></li> </ul>
--- a/tests/test-hgweb-removed.t Sat Mar 12 11:19:44 2011 +0100 +++ b/tests/test-hgweb-removed.t Sat Mar 12 11:20:03 2011 +0100 @@ -38,6 +38,7 @@ <li><a href="/shortlog/c78f6c5cbea9">log</a></li> <li><a href="/graph/c78f6c5cbea9">graph</a></li> <li><a href="/tags">tags</a></li> + <li><a href="/bookmarks">bookmarks</a></li> <li><a href="/branches">branches</a></li> </ul> <ul> @@ -133,6 +134,7 @@ <li><a href="/shortlog/c78f6c5cbea9">log</a></li> <li><a href="/graph/c78f6c5cbea9">graph</a></li> <li><a href="/tags">tags</a></li> + <li><a href="/bookmarks">bookmarks</a></li> <li><a href="/branches">branches</a></li> </ul> <ul>
--- a/tests/test-hgweb.t Sat Mar 12 11:19:44 2011 +0100 +++ b/tests/test-hgweb.t Sat Mar 12 11:20:03 2011 +0100 @@ -62,6 +62,7 @@ <li><a href="/shortlog">log</a></li> <li><a href="/graph">graph</a></li> <li><a href="/tags">tags</a></li> + <li><a href="/bookmarks">bookmarks</a></li> <li><a href="/branches">branches</a></li> <li><a href="/help">help</a></li> </ul> @@ -147,6 +148,7 @@ <li><a href="/shortlog">log</a></li> <li><a href="/graph">graph</a></li> <li><a href="/tags">tags</a></li> + <li><a href="/bookmarks">bookmarks</a></li> <li><a href="/branches">branches</a></li> <li><a href="/help">help</a></li> </ul> @@ -214,6 +216,7 @@ <li><a href="/shortlog/2ef0ac749a14">log</a></li> <li><a href="/graph/2ef0ac749a14">graph</a></li> <li><a href="/tags">tags</a></li> + <li><a href="/bookmarks">bookmarks</a></li> <li><a href="/branches">branches</a></li> </ul> <ul>