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.
--- 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 ..