changeset 19632:299511aabf85

hgweb: pass arguments which a function depends on explicitly in search This changes makes clearer which arguments can a function depend on. Now all the modified functions depend on the 'query' argument only, but future additions will change it.
author Alexander Plavin <alexander@plav.in>
date Thu, 22 Aug 2013 16:42:10 +0400
parents cf9e5e45c1d3
children 217f2b9acee0
files mercurial/hgweb/webcommands.py
diffstat 1 files changed, 5 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/hgweb/webcommands.py	Thu Aug 22 16:45:23 2013 +0400
+++ b/mercurial/hgweb/webcommands.py	Thu Aug 22 16:42:10 2013 +0400
@@ -110,7 +110,7 @@
 
 def _search(web, req, tmpl):
 
-    def keywordsearch():
+    def keywordsearch(query):
         lower = encoding.lower
         qw = lower(query).split()
 
@@ -142,13 +142,13 @@
         'keyword': keywordsearch,
     }
 
-    def getsearchmode():
-        return 'keyword'
+    def getsearchmode(query):
+        return 'keyword', query
 
     def changelist(**map):
         count = 0
 
-        for ctx in searchfunc():
+        for ctx in searchfunc(funcarg):
             count += 1
             n = ctx.node()
             showtags = webutil.showtag(web.repo, tmpl, 'changelogtag', n)
@@ -188,7 +188,7 @@
     morevars['revcount'] = revcount * 2
     morevars['rev'] = query
 
-    mode = getsearchmode()
+    mode, funcarg = getsearchmode(query)
     searchfunc = searchfuncs[mode]
 
     tip = web.repo['tip']