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

Alexander Plavin alexander at plav.in
Fri Aug 16 15:06:28 CDT 2013


# HG changeset patch
# User Alexander Plavin <alexander at 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

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):
 


More information about the Mercurial-devel mailing list