changeset 19533:9a020b354d93

hgweb: separate search itself and template generation This will make it simpler to add other search modes.
author Alexander Plavin <alexander@plav.in>
date Mon, 15 Jul 2013 01:10:22 +0400
parents b5e3f2b1d5e9
children 983bb4069004
files mercurial/hgweb/webcommands.py
diffstat 1 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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)