changeset 19633:217f2b9acee0

hgweb: search() function supports direct pointing to revision This doesn't change the behavior, as queries directly pointing to revisions are not delegated to the search() function now.
author Alexander Plavin <alexander@plav.in>
date Fri, 19 Jul 2013 02:41:11 +0400
parents 299511aabf85
children 49a068b8fb0c
files mercurial/hgweb/webcommands.py
diffstat 1 files changed, 10 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/hgweb/webcommands.py	Thu Aug 22 16:42:10 2013 +0400
+++ b/mercurial/hgweb/webcommands.py	Fri Jul 19 02:41:11 2013 +0400
@@ -110,6 +110,9 @@
 
 def _search(web, req, tmpl):
 
+    def revsearch(ctx):
+        yield ctx
+
     def keywordsearch(query):
         lower = encoding.lower
         qw = lower(query).split()
@@ -139,11 +142,17 @@
             yield ctx
 
     searchfuncs = {
+        'rev': revsearch,
         'keyword': keywordsearch,
     }
 
     def getsearchmode(query):
-        return 'keyword', query
+        try:
+            ctx = web.repo[query]
+        except (error.RepoError, error.LookupError):
+            return 'keyword', query
+        else:
+            return 'rev', ctx
 
     def changelist(**map):
         count = 0