hgweb: separate search itself and template generation
authorAlexander Plavin <alexander@plav.in>
Mon, 15 Jul 2013 01:10:22 +0400
changeset 19533 9a020b354d93
parent 19532 b5e3f2b1d5e9
child 19534 983bb4069004
hgweb: separate search itself and template generation This will make it simpler to add other search modes.
mercurial/hgweb/webcommands.py
--- a/mercurial/hgweb/webcommands.py	Sat Aug 03 00:34:56 2013 +0400
+++ b/mercurial/hgweb/webcommands.py	Mon Jul 15 01:10:22 2013 +0400
@@ -110,8 +110,7 @@
 
 def _search(web, req, tmpl):
 
-    def changelist(**map):
-        count = 0
+    def keywordsearch():
         lower = encoding.lower
         qw = lower(query).split()
 
@@ -137,6 +136,12 @@
             if miss:
                 continue
 
+            yield ctx
+
+    def changelist(**map):
+        count = 0
+
+        for ctx in keywordsearch():
             count += 1
             n = ctx.node()
             showtags = webutil.showtag(web.repo, tmpl, 'changelogtag', n)