Patchwork [1,of,4] hgweb: separate search itself and template generation

login
register
mail settings
Submitter Alexander Plavin
Date Aug. 2, 2013, 9:55 p.m.
Message ID <ff99b04ed3eef4b077f4.1375480540@debian-alexander.dolgopa>
Download mbox | patch
Permalink /patch/1996/
State Accepted
Commit 9a020b354d933694bbc4858f36aad396b96aeb9c
Headers show

Comments

Alexander Plavin - Aug. 2, 2013, 9:55 p.m.
# HG changeset patch
# User Alexander Plavin <alexander@plav.in>
# Date 1373836222 -14400
#      Mon Jul 15 01:10:22 2013 +0400
# Node ID ff99b04ed3eef4b077f4e6b93e5adf919b0d691d
# Parent  11ac049356d4894642313803d9edc1ff2e9d2788
hgweb: separate search itself and template generation

This will make it simpler to add other search modes.

Patch

diff -r 11ac049356d4 -r ff99b04ed3ee mercurial/hgweb/webcommands.py
--- a/mercurial/hgweb/webcommands.py	Wed Jul 24 03:20:26 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)