changeset 19765:521c373ff134

hgweb: pass variable with current search mode name to the search template
author Alexander Plavin <alexander@plav.in>
date Fri, 06 Sep 2013 13:30:56 +0400
parents ea35caf324bb
children 393e9f1fc4d2
files mercurial/hgweb/webcommands.py
diffstat 1 files changed, 6 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/hgweb/webcommands.py	Fri Sep 20 11:47:03 2013 -0500
+++ b/mercurial/hgweb/webcommands.py	Fri Sep 06 13:30:56 2013 +0400
@@ -151,9 +151,9 @@
             yield web.repo[r]
 
     searchfuncs = {
-        MODE_REVISION: revsearch,
-        MODE_KEYWORD: keywordsearch,
-        MODE_REVSET: revsetsearch,
+        MODE_REVISION: (revsearch, _('exact revision search')),
+        MODE_KEYWORD: (keywordsearch, _('literal keyword search')),
+        MODE_REVSET: (revsetsearch, _('revset expression search')),
     }
 
     def getsearchmode(query):
@@ -199,7 +199,7 @@
     def changelist(**map):
         count = 0
 
-        for ctx in searchfunc(funcarg):
+        for ctx in searchfunc[0](funcarg):
             count += 1
             n = ctx.node()
             showtags = webutil.showtag(web.repo, tmpl, 'changelogtag', n)
@@ -247,7 +247,8 @@
 
     return tmpl('search', query=query, node=tip.hex(),
                 entries=changelist, archives=web.archivelist("tip"),
-                morevars=morevars, lessvars=lessvars)
+                morevars=morevars, lessvars=lessvars,
+                modedesc=searchfunc[1])
 
 def changelog(web, req, tmpl, shortlog=False):