changeset 19462:a87d9102f7af

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.
author Alexander Plavin <me@aplavin.ru>
date Sat, 13 Jul 2013 02:36:29 +0400
parents dd7c992d3cc1
children f3393d458bf5
files mercurial/hgweb/webcommands.py tests/test-hgweb-commands.t
diffstat 2 files changed, 1 insertions(+), 34 deletions(-) [+]
line wrap: on
line diff
--- 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>&#116;&#101;&#115;&#116;</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>&#116;&#101;&#115;&#116;</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)