Mercurial > hg
comparison mercurial/hgweb/webcommands.py @ 19768:186f54d40fdd
hgweb: add link to force literal keyword search
This makes it possible to make keyword search in case the search query also
specifies an exact revision (like '1234' or 'abcdef'), or a revset expression.
author | Alexander Plavin <alexander@plav.in> |
---|---|
date | Fri, 06 Sep 2013 13:30:56 +0400 |
parents | 521c373ff134 |
children | 681f7b9213a4 |
comparison
equal
deleted
inserted
replaced
19767:d45010687268 | 19768:186f54d40fdd |
---|---|
238 morevars = copy.copy(tmpl.defaults['sessionvars']) | 238 morevars = copy.copy(tmpl.defaults['sessionvars']) |
239 morevars['revcount'] = revcount * 2 | 239 morevars['revcount'] = revcount * 2 |
240 morevars['rev'] = query | 240 morevars['rev'] = query |
241 | 241 |
242 mode, funcarg = getsearchmode(query) | 242 mode, funcarg = getsearchmode(query) |
243 | |
244 if 'forcekw' in req.form: | |
245 showforcekw = '' | |
246 showunforcekw = searchfuncs[mode][1] | |
247 mode = MODE_KEYWORD | |
248 funcarg = query | |
249 else: | |
250 if mode != MODE_KEYWORD: | |
251 showforcekw = searchfuncs[MODE_KEYWORD][1] | |
252 else: | |
253 showforcekw = '' | |
254 showunforcekw = '' | |
255 | |
243 searchfunc = searchfuncs[mode] | 256 searchfunc = searchfuncs[mode] |
244 | 257 |
245 tip = web.repo['tip'] | 258 tip = web.repo['tip'] |
246 parity = paritygen(web.stripecount) | 259 parity = paritygen(web.stripecount) |
247 | 260 |
248 return tmpl('search', query=query, node=tip.hex(), | 261 return tmpl('search', query=query, node=tip.hex(), |
249 entries=changelist, archives=web.archivelist("tip"), | 262 entries=changelist, archives=web.archivelist("tip"), |
250 morevars=morevars, lessvars=lessvars, | 263 morevars=morevars, lessvars=lessvars, |
251 modedesc=searchfunc[1]) | 264 modedesc=searchfunc[1], |
265 showforcekw=showforcekw, showunforcekw=showunforcekw) | |
252 | 266 |
253 def changelog(web, req, tmpl, shortlog=False): | 267 def changelog(web, req, tmpl, shortlog=False): |
254 | 268 |
255 query = '' | 269 query = '' |
256 if 'node' in req.form: | 270 if 'node' in req.form: |