[PATCH 2 of 4] hgweb: sort bookmarks in the same manner as console command
Yuya Nishihara
yuya at tcha.org
Sat Apr 9 20:04:14 CDT 2011
# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1302397297 -32400
# Node ID 6e0fb0c181d9cb81471dcb580f7d88209aae50ba
# Parent 40928f8c7eb2b29cd54912bbe50ca934a12cccff
hgweb: sort bookmarks in the same manner as console command
diff --git a/mercurial/hgweb/webcommands.py b/mercurial/hgweb/webcommands.py
--- a/mercurial/hgweb/webcommands.py
+++ b/mercurial/hgweb/webcommands.py
@@ -393,12 +393,11 @@ def tags(web, req, tmpl):
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:
+ for k, n in sorted(i):
if notip and k == "tip":
continue
if limit > 0 and count >= limit:
diff --git a/tests/test-hgweb-commands.t b/tests/test-hgweb-commands.t
--- a/tests/test-hgweb-commands.t
+++ b/tests/test-hgweb-commands.t
@@ -16,6 +16,7 @@ Set up the repo
adding foo
$ hg tag 1.0
$ hg bookmark something
+ $ hg bookmark -r0 anotherthing
$ echo another > foo
$ hg branch stable
marked working directory as branch stable
@@ -256,7 +257,7 @@ Logs and changes
<tr class="parity0">
<td class="age">1970-01-01</td>
<td class="author">test</td>
- <td class="description"><a href="/rev/2ef0ac749a14">base</a><span class="tag">1.0</span> </td>
+ <td class="description"><a href="/rev/2ef0ac749a14">base</a><span class="tag">1.0</span> <span class="tag">anotherthing</span> </td>
</tr>
</table>
@@ -317,7 +318,7 @@ Logs and changes
<div class="main">
<h2><a href="/">test</a></h2>
- <h3>changeset 0:2ef0ac749a14 <span class="tag">1.0</span> </h3>
+ <h3>changeset 0:2ef0ac749a14 <span class="tag">1.0</span> <span class="tag">anotherthing</span> </h3>
<form class="search" action="/log">
@@ -443,7 +444,7 @@ Logs and changes
<tr class="parity0">
<td class="age">1970-01-01</td>
<td class="author">test</td>
- <td class="description"><a href="/rev/2ef0ac749a14">base</a><span class="tag">1.0</span> </td>
+ <td class="description"><a href="/rev/2ef0ac749a14">base</a><span class="tag">1.0</span> <span class="tag">anotherthing</span> </td>
</tr>
</table>
@@ -606,6 +607,7 @@ Overviews
$ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT '/raw-bookmarks'
200 Script output follows
+ anotherthing 2ef0ac749a14e4f57a5a822464a0902c6f7f448f
something 1d22e65f027e5a0609357e7d8e7508cd2ba5d2fe
$ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT '/summary/?style=gitweb'
200 Script output follows
@@ -695,7 +697,7 @@ Overviews
<td>
<a class="list" href="/rev/2ef0ac749a14?style=gitweb">
<b>base</b>
- <span class="logtags"><span class="tagtag" title="1.0">1.0</span> </span>
+ <span class="logtags"><span class="tagtag" title="1.0">1.0</span> <span class="bookmarktag" title="anotherthing">anotherthing</span> </span>
</a>
</td>
<td class="link" nowrap>
@@ -821,7 +823,7 @@ Overviews
<script>
<!-- hide script content
- var data = [["1d22e65f027e", [0, 1], [[0, 0, 1]], "branch", "test", "1970-01-01", ["stable", true], ["tip"], ["something"]], ["a4f92ed23982", [0, 1], [[0, 0, 1]], "Added tag 1.0 for changeset 2ef0ac749a14", "test", "1970-01-01", ["default", true], [], []], ["2ef0ac749a14", [0, 1], [], "base", "test", "1970-01-01", ["default", false], ["1.0"], []]];
+ var data = [["1d22e65f027e", [0, 1], [[0, 0, 1]], "branch", "test", "1970-01-01", ["stable", true], ["tip"], ["something"]], ["a4f92ed23982", [0, 1], [[0, 0, 1]], "Added tag 1.0 for changeset 2ef0ac749a14", "test", "1970-01-01", ["default", true], [], []], ["2ef0ac749a14", [0, 1], [], "base", "test", "1970-01-01", ["default", false], ["1.0"], ["anotherthing"]]];
var graph = new Graph();
graph.scale(39);
@@ -1086,7 +1088,7 @@ Graph json escape of multibyte character
$ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT '/graph/' \
> | grep '^var data ='
- var data = [["40b4d6888e92", [0, 1], [[0, 0, 1]], "\u80fd", "test", "1970-01-01", ["stable", true], ["tip"], ["something"]], ["1d22e65f027e", [0, 1], [[0, 0, 1]], "branch", "test", "1970-01-01", ["stable", false], [], []], ["a4f92ed23982", [0, 1], [[0, 0, 1]], "Added tag 1.0 for changeset 2ef0ac749a14", "test", "1970-01-01", ["default", true], [], []], ["2ef0ac749a14", [0, 1], [], "base", "test", "1970-01-01", ["default", false], ["1.0"], []]];
+ var data = [["40b4d6888e92", [0, 1], [[0, 0, 1]], "\u80fd", "test", "1970-01-01", ["stable", true], ["tip"], ["something"]], ["1d22e65f027e", [0, 1], [[0, 0, 1]], "branch", "test", "1970-01-01", ["stable", false], [], []], ["a4f92ed23982", [0, 1], [[0, 0, 1]], "Added tag 1.0 for changeset 2ef0ac749a14", "test", "1970-01-01", ["default", true], [], []], ["2ef0ac749a14", [0, 1], [], "base", "test", "1970-01-01", ["default", false], ["1.0"], ["anotherthing"]]];
ERRORS ENCOUNTERED
More information about the Mercurial-devel
mailing list