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

Alexander Plavin alexander at plav.in
Thu Aug 22 10:12:21 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 054291a49c176301d61714f5d5f67f80c18b657a
# Parent  90d7565658c737cf929f9380c13adaccd6cdbc15
hgweb: pass variable with current search mode name to the search template

diff -r 90d7565658c7 -r 054291a49c17 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(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):
 


More information about the Mercurial-devel mailing list