Patchwork [3,of,3,V2] hgweb: always run search when a query is entered

login
register
mail settings
Submitter Alexander Plavin
Date Aug. 16, 2013, 8 p.m.
Message ID <1520c3c2bfff34a96b76.1376683246@debian-alexander.dolgopa>
Download mbox | patch
Permalink /patch/2181/
State Superseded
Headers show

Comments

Alexander Plavin - Aug. 16, 2013, 8 p.m.
# HG changeset patch
# User Alexander Plavin <alexander@plav.in>
# Date 1374185353 -14400
#      Fri Jul 19 02:09:13 2013 +0400
# Node ID 1520c3c2bfff34a96b76790d1c293c3c48b912e0
# Parent  f36e11723a01737156e3a79887a6b7ccc8fa6ed0
hgweb: always run search when a query is entered

This changes the behavior for queries which point at a revision directly,
now the output is consistend to other cases: it results in only this matched
revision shown, not the log starting with it.
A new test checks this behaviour and fails for the old one.

Patch

diff -r f36e11723a01 -r 1520c3c2bfff mercurial/hgweb/webcommands.py
--- a/mercurial/hgweb/webcommands.py	Fri Jul 19 02:41:11 2013 +0400
+++ b/mercurial/hgweb/webcommands.py	Fri Jul 19 02:09:13 2013 +0400
@@ -212,11 +212,7 @@ 
     if 'node' in req.form:
         ctx = webutil.changectx(web.repo, req)
     elif 'rev' in req.form:
-        query = req.form['rev'][0]
-        try:
-            ctx = web.repo[query]
-        except (error.RepoError, error.LookupError):
-            return _search(web, req, tmpl) # XXX redirect to 404 page?
+        return _search(web, req, tmpl)
     else:
         ctx = web.repo['tip']
 
diff -r f36e11723a01 -r 1520c3c2bfff tests/test-hgweb-commands.t
--- a/tests/test-hgweb-commands.t	Fri Jul 19 02:41:11 2013 +0400
+++ b/tests/test-hgweb-commands.t	Fri Jul 19 02:09:13 2013 +0400
@@ -534,6 +534,8 @@ 
   </body>
   </html>
   
+  $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT 'log?rev=stable&style=raw' | grep 'revision:'
+  revision:    2
 
 File-related