changeset 18497:a58d8936647a stable

hgweb: prevent traceback during search when filtered (issue3783) The search needs to iterate over the repo using changelog.revs like the rest of the Mercurial code.
author Pierre-Yves David <pierre-yves.david@logilab.fr>
date Tue, 29 Jan 2013 16:44:51 +0100
parents d1c13a4dc638
children 4d9f7dd2ac82
files mercurial/hgweb/webcommands.py tests/test-hgweb-commands.t
diffstat 2 files changed, 10 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/hgweb/webcommands.py	Sun Jan 27 15:13:53 2013 -0600
+++ b/mercurial/hgweb/webcommands.py	Tue Jan 29 16:44:51 2013 +0100
@@ -129,9 +129,10 @@
         qw = lower(query).split()
 
         def revgen():
+            cl = web.repo.changelog
             for i in xrange(len(web.repo) - 1, 0, -100):
                 l = []
-                for j in xrange(max(0, i - 100), i + 1):
+                for j in cl.revs(max(0, i - 100), i + 1):
                     ctx = web.repo[j]
                     l.append(ctx)
                 l.reverse()
--- a/tests/test-hgweb-commands.t	Sun Jan 27 15:13:53 2013 -0600
+++ b/tests/test-hgweb-commands.t	Tue Jan 29 16:44:51 2013 +0100
@@ -1392,4 +1392,12 @@
   $ QUERY_STRING='cmd=listkeys&namespace=bookmarks'
   $ python hgweb.cgi
 
+search works with filtering
+
+  $ PATH_INFO=/log; export PATH_INFO
+  $ QUERY_STRING='rev=babar'
+  $ python hgweb.cgi > search
+  $ grep Status search
+  Status: 200 Script output follows\r (esc)
+
   $ cd ..