Mercurial > hg
changeset 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 | d45010687268 |
children | 0361163efbaf |
files | mercurial/hgweb/webcommands.py mercurial/templates/paper/search.tmpl tests/test-hgweb-commands.t |
diffstat | 3 files changed, 21 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/hgweb/webcommands.py Fri Sep 06 13:30:56 2013 +0400 +++ b/mercurial/hgweb/webcommands.py Fri Sep 06 13:30:56 2013 +0400 @@ -240,6 +240,19 @@ morevars['rev'] = query mode, funcarg = getsearchmode(query) + + if 'forcekw' in req.form: + showforcekw = '' + showunforcekw = searchfuncs[mode][1] + mode = MODE_KEYWORD + funcarg = query + else: + if mode != MODE_KEYWORD: + showforcekw = searchfuncs[MODE_KEYWORD][1] + else: + showforcekw = '' + showunforcekw = '' + searchfunc = searchfuncs[mode] tip = web.repo['tip'] @@ -248,7 +261,8 @@ return tmpl('search', query=query, node=tip.hex(), entries=changelist, archives=web.archivelist("tip"), morevars=morevars, lessvars=lessvars, - modedesc=searchfunc[1]) + modedesc=searchfunc[1], + showforcekw=showforcekw, showunforcekw=showunforcekw) def changelog(web, req, tmpl, shortlog=False):
--- a/mercurial/templates/paper/search.tmpl Fri Sep 06 13:30:56 2013 +0400 +++ b/mercurial/templates/paper/search.tmpl Fri Sep 06 13:30:56 2013 +0400 @@ -25,6 +25,10 @@ <p> Assuming {modedesc}. +{if(showforcekw, '<a href="{url|urlescape}log?rev={query|urlescape}&forcekw=1"> +Use {showforcekw}</a> instead.')} +{if(showunforcekw, '<a href="{url|urlescape}log?rev={query|urlescape}"> +Use {showunforcekw}</a> instead.')} </p> <form class="search" action="{url|urlescape}log">