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

login
register
mail settings
Submitter Alexander Plavin
Date Aug. 16, 2013, 8:06 p.m.
Message ID <f68389762caa26b62176.1376683588@debian-alexander.dolgopa>
Download mbox | patch
Permalink /patch/2190/
State Superseded
Headers show

Comments

Alexander Plavin - Aug. 16, 2013, 8:06 p.m.
# HG changeset patch
# User Alexander Plavin <alexander@plav.in>
# Date 1376674724 -14400
#      Fri Aug 16 21:38:44 2013 +0400
# Node ID f68389762caa26b62176b2982c34f3adcf347f69
# Parent  7ab9fd34cfad91aeb07558fbacce36eaef28abe5
hgweb: pass variable with current search mode name to the search template

Patch

diff -r 7ab9fd34cfad -r f68389762caa mercurial/hgweb/webcommands.py
--- a/mercurial/hgweb/webcommands.py	Fri Aug 16 15:04:14 2013 +0400
+++ b/mercurial/hgweb/webcommands.py	Fri Aug 16 21:38:44 2013 +0400
@@ -149,9 +149,9 @@ 
             yield web.repo[r]
 
     searchfuncs = {
-        'rev': revsearch,
-        'kw': keywordsearch,
-        'revset': revsetsearch,
+        'rev': (revsearch, _('exact revision')),
+        'kw': (keywordsearch, _('literal keyword')),
+        'revset': (revsetsearch, _('revset expression')),
     }
 
     def getsearchmode():
@@ -199,7 +199,7 @@ 
     def changelist(**map):
         count = 0
 
-        for ctx in searchfunc():
+        for ctx in searchfunc[0]():
             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):