[PATCH 1 of 3 V2] hgweb: add dynamic search function selection, depending on the query
Alexander Plavin
alexander at plav.in
Fri Aug 16 15:00:44 CDT 2013
# HG changeset patch
# User Alexander Plavin <alexander at plav.in>
# Date 1376652944 -14400
# Fri Aug 16 15:35:44 2013 +0400
# Node ID 7de4329371abefa30c9776084d54fd1cb9e0e6c3
# Parent 74dbeaab9631fe063e55e130f699242ab4dfc01e
hgweb: add dynamic search function selection, depending on the query
This allows adding other specific search functions, in addition to current
keyword search.
diff -r 74dbeaab9631 -r 7de4329371ab mercurial/hgweb/webcommands.py
--- a/mercurial/hgweb/webcommands.py Wed Jul 24 03:20:26 2013 +0400
+++ b/mercurial/hgweb/webcommands.py Fri Aug 16 15:35:44 2013 +0400
@@ -138,10 +138,17 @@
yield ctx
+ searchfuncs = {
+ 'kw': keywordsearch,
+ }
+
+ def getsearchmode():
+ return 'kw'
+
def changelist(**map):
count = 0
- for ctx in keywordsearch():
+ for ctx in searchfunc():
count += 1
n = ctx.node()
showtags = webutil.showtag(web.repo, tmpl, 'changelogtag', n)
@@ -181,6 +188,8 @@
morevars['revcount'] = revcount * 2
morevars['rev'] = query
+ searchfunc = searchfuncs[getsearchmode()]
+
tip = web.repo['tip']
parity = paritygen(web.stripecount)
More information about the Mercurial-devel
mailing list