diff mercurial/hgweb/webcommands.py @ 38931:5caee9f923ae stable

hgweb: catch ParseError that's raised by revset.match() Some queries, like the demonstrated "first(::)", fail earlier than we call mfunc(), and that results in a "500 Internal Server Error". To prevent it, revset.match() also needs to be in a try-except block.
author Anton Shestakov <av6@dwimlabs.net>
date Thu, 09 Aug 2018 13:04:52 +0800
parents 5faaa31a6082
children 08b2ae9fc030 ede3bf31fe63
line wrap: on
line diff
--- a/mercurial/hgweb/webcommands.py	Fri Aug 03 15:09:19 2018 -0400
+++ b/mercurial/hgweb/webcommands.py	Thu Aug 09 13:04:52 2018 +0800
@@ -276,9 +276,9 @@
         if not funcsused.issubset(revset.safesymbols):
             return MODE_KEYWORD, query
 
-        mfunc = revset.match(web.repo.ui, revdef,
-                             lookup=revset.lookupfn(web.repo))
         try:
+            mfunc = revset.match(web.repo.ui, revdef,
+                                 lookup=revset.lookupfn(web.repo))
             revs = mfunc(web.repo)
             return MODE_REVSET, revs
             # ParseError: wrongly placed tokens, wrongs arguments, etc