hgweb: pass variable with current search mode name to the search template
authorAlexander Plavin <alexander@plav.in>
Fri, 06 Sep 2013 13:30:56 +0400
changeset 19765 521c373ff134
parent 19763 ea35caf324bb
child 19766 393e9f1fc4d2
hgweb: pass variable with current search mode name to the search template
mercurial/hgweb/webcommands.py
--- 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):