Patchwork [1,of,4,V4] hgweb: pass variable with current search mode name to the search template

login
register
mail settings
Submitter Alexander Plavin
Date Sept. 11, 2013, 4:54 p.m.
Message ID <c519a51c80a73cc23884.1378918441@debian-alexander.dolgopa>
Download mbox | patch
Permalink /patch/2423/
State Accepted
Commit 521c373ff13406bc772a7a78e2743a49863ae85c
Headers show

Comments

Alexander Plavin - Sept. 11, 2013, 4:54 p.m.
# HG changeset patch
# User Alexander Plavin <alexander@plav.in>
# Date 1378459856 -14400
#      Fri Sep 06 13:30:56 2013 +0400
# Node ID c519a51c80a73cc2388458b4d5f5f92e594d0532
# Parent  ab7d6890e62500ad220ba733db2af7edf055c5f4
hgweb: pass variable with current search mode name to the search template

Patch

diff -r ab7d6890e625 -r c519a51c80a7 mercurial/hgweb/webcommands.py
--- a/mercurial/hgweb/webcommands.py	Fri Sep 06 13:30:56 2013 +0400
+++ 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):
@@ -200,7 +200,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)
@@ -248,7 +248,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):