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

Alexander Plavin alexander at plav.in
Fri Aug 2 16:55:40 CDT 2013


# HG changeset patch
# User Alexander Plavin <alexander at 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.

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)


More information about the Mercurial-devel mailing list