[PATCH 2 of 4 RFC] hgweb: separate search itself and template generation into two functions
Alexander Plavin
me at aplavin.ru
Sun Jul 14 16:45:27 CDT 2013
# HG changeset patch
# User Alexander Plavin <me at aplavin.ru>
# Date 1373836222 -14400
# Mon Jul 15 01:10:22 2013 +0400
# Node ID 8c4a2c55d87bff120c49b6c65c124f47df02a26c
# Parent 28d3d31e969f8e539455963953962c87a1025066
hgweb: separate search itself and template generation into two functions
diff -r 28d3d31e969f -r 8c4a2c55d87b mercurial/hgweb/webcommands.py
--- a/mercurial/hgweb/webcommands.py Mon Jul 15 01:05:42 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 simplesearch():
lower = encoding.lower
qw = lower(query).split()
@@ -137,6 +136,12 @@
if miss:
continue
+ yield ctx
+
+ def changelist(**map):
+ count = 0
+
+ for ctx in searchf():
count += 1
n = ctx.node()
showtags = webutil.showtag(web.repo, tmpl, 'changelogtag', n)
@@ -179,6 +184,8 @@
tip = web.repo['tip']
parity = paritygen(web.stripecount)
+ searchf = simplesearch
+
return tmpl('search', query=query, node=tip.hex(),
entries=changelist, archives=web.archivelist("tip"),
morevars=morevars, lessvars=lessvars)
More information about the Mercurial-devel
mailing list