hgweb: always start log with searched revision
This makes the specified revision be always on top of the list.
Before the patch, for example with repo having revisions 0, 1, 2, 3 and user
searching for '2', all revisions were shown and the specified one wasn't
the first.
--- a/mercurial/hgweb/webcommands.py Mon Jul 01 06:50:58 2013 +0200
+++ b/mercurial/hgweb/webcommands.py Sat Jul 13 02:36:29 2013 +0400
@@ -247,8 +247,7 @@
count = len(web.repo)
pos = ctx.rev()
start = max(0, pos - revcount + 1)
- end = min(count, start + revcount)
- pos = end - 1
+ end = pos + 1
parity = paritygen(web.stripecount, offset=start - end)
changenav = webutil.revnav(web.repo).gen(pos, revcount, count)
--- a/tests/test-hgweb-commands.t Mon Jul 01 06:50:58 2013 +0200
+++ b/tests/test-hgweb-commands.t Sat Jul 13 02:36:29 2013 +0400
@@ -140,38 +140,6 @@
<updated>1970-01-01T00:00:00+00:00</updated>
<entry>
- <title>branch commit with null character: </title>
- <id>http://*:$HGPORT/#changeset-cad8025a2e87f88c06259790adfa15acb4080123</id> (glob)
- <link href="http://*:$HGPORT/rev/cad8025a2e87"/> (glob)
- <author>
- <name>test</name>
- <email>test</email>
- </author>
- <updated>1970-01-01T00:00:00+00:00</updated>
- <published>1970-01-01T00:00:00+00:00</published>
- <content type="xhtml">
- <div xmlns="http://www.w3.org/1999/xhtml">
- <pre xml:space="preserve">branch commit with null character: </pre>
- </div>
- </content>
- </entry>
- <entry>
- <title>branch</title>
- <id>http://*:$HGPORT/#changeset-1d22e65f027e5a0609357e7d8e7508cd2ba5d2fe</id> (glob)
- <link href="http://*:$HGPORT/rev/1d22e65f027e"/> (glob)
- <author>
- <name>test</name>
- <email>test</email>
- </author>
- <updated>1970-01-01T00:00:00+00:00</updated>
- <published>1970-01-01T00:00:00+00:00</published>
- <content type="xhtml">
- <div xmlns="http://www.w3.org/1999/xhtml">
- <pre xml:space="preserve">branch</pre>
- </div>
- </content>
- </entry>
- <entry>
<title>Added tag 1.0 for changeset 2ef0ac749a14</title>
<id>http://*:$HGPORT/#changeset-a4f92ed23982be056b9852de5dfe873eaac7f0de</id> (glob)
<link href="http://*:$HGPORT/rev/a4f92ed23982"/> (glob)