Patchwork [4,of,4,V3] hgweb: always run search when a query is entered

login
register
mail settings
Submitter Alexander Plavin
Date Aug. 22, 2013, 3:09 p.m.
Message ID <04c91751cbf8abc1f3ea.1377184170@debian-alexander.dolgopa>
Download mbox | patch
Permalink /patch/2242/
State Deferred
Headers show

Comments

Alexander Plavin - Aug. 22, 2013, 3:09 p.m.
# HG changeset patch
# User Alexander Plavin <alexander@plav.in>
# Date 1374185353 -14400
#      Fri Jul 19 02:09:13 2013 +0400
# Node ID 04c91751cbf8abc1f3ea56c67ca4988e0e8e61a5
# Parent  ffa9a6d28047bfe1803676327269a1426769a7a8
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.
Augie Fackler - Aug. 26, 2013, 2:45 p.m.
On Thu, Aug 22, 2013 at 07:09:30PM +0400, Alexander Plavin wrote:
> # HG changeset patch
> # User Alexander Plavin <alexander@plav.in>
> # Date 1374185353 -14400
> #      Fri Jul 19 02:09:13 2013 +0400
> # Node ID 04c91751cbf8abc1f3ea56c67ca4988e0e8e61a5
> # Parent  ffa9a6d28047bfe1803676327269a1426769a7a8
> hgweb: always run search when a query is entered

flag with (bc) since it's a behavior change

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

typo: consistend

> revision shown, not the log starting with it.
> A new test checks this behaviour and fails for the old one.
>
> diff -r ffa9a6d28047 -r 04c91751cbf8 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
> @@ -213,11 +213,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 ffa9a6d28047 -r 04c91751cbf8 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
>
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
Alexander Plavin - Aug. 27, 2013, 7:30 a.m.
26.08.2013, 18:45, "Augie Fackler" <raf@durin42.com>:
> On Thu, Aug 22, 2013 at 07:09:30PM +0400, Alexander Plavin wrote:
>
>>  # HG changeset patch
>>  # User Alexander Plavin <alexander@plav.in>
>>  # Date 1374185353 -14400
>>  #      Fri Jul 19 02:09:13 2013 +0400
>>  # Node ID 04c91751cbf8abc1f3ea56c67ca4988e0e8e61a5
>>  # Parent  ffa9a6d28047bfe1803676327269a1426769a7a8
>>  hgweb: always run search when a query is entered
>
> flag with (bc) since it's a behavior change

You mean adding '(bc)' to the end of commit message (as there are in some commits in the repo), right?

>
>>  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
>
> typo: consistend

Done.

>
>>  revision shown, not the log starting with it.
>>  A new test checks this behaviour and fails for the old one.
>>
>>  diff -r ffa9a6d28047 -r 04c91751cbf8 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
>>  @@ -213,11 +213,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 ffa9a6d28047 -r 04c91751cbf8 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
>>
>>  _______________________________________________
>>  Mercurial-devel mailing list
>>  Mercurial-devel@selenic.com
>>  http://selenic.com/mailman/listinfo/mercurial-devel
Augie Fackler - Aug. 27, 2013, 2:58 p.m.
On Tue, Aug 27, 2013 at 11:30:35AM +0400, Alexander Plavin wrote:
>
>
> 26.08.2013, 18:45, "Augie Fackler" <raf@durin42.com>:
> > On Thu, Aug 22, 2013 at 07:09:30PM +0400, Alexander Plavin wrote:
> >
> >>  # HG changeset patch
> >>  # User Alexander Plavin <alexander@plav.in>
> >>  # Date 1374185353 -14400
> >>  #      Fri Jul 19 02:09:13 2013 +0400
> >>  # Node ID 04c91751cbf8abc1f3ea56c67ca4988e0e8e61a5
> >>  # Parent  ffa9a6d28047bfe1803676327269a1426769a7a8
> >>  hgweb: always run search when a query is entered
> >
> > flag with (bc) since it's a behavior change
>
> You mean adding '(bc)' to the end of commit message (as there are in some commits in the repo), right?

Yep.

>
> >
> >>  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
> >
> > typo: consistend
>
> Done.
>
> >
> >>  revision shown, not the log starting with it.
> >>  A new test checks this behaviour and fails for the old one.
> >>
> >>  diff -r ffa9a6d28047 -r 04c91751cbf8 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
> >>  @@ -213,11 +213,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 ffa9a6d28047 -r 04c91751cbf8 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
> >>
> >>  _______________________________________________
> >>  Mercurial-devel mailing list
> >>  Mercurial-devel@selenic.com
> >>  http://selenic.com/mailman/listinfo/mercurial-devel

Patch

diff -r ffa9a6d28047 -r 04c91751cbf8 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
@@ -213,11 +213,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 ffa9a6d28047 -r 04c91751cbf8 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