Mercurial > hg-stable
changeset 19656:60ce14e41faf
hgweb: add string constants for search mode names
It helps detecting mistakes in the mode names.
author | Alexander Plavin <alexander@plav.in> |
---|---|
date | Wed, 04 Sep 2013 19:40:04 +0400 |
parents | 1d07bf106c2a |
children | 145636d31bb4 |
files | mercurial/hgweb/webcommands.py |
diffstat | 1 files changed, 6 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/hgweb/webcommands.py Wed Sep 04 18:42:55 2013 -0700 +++ b/mercurial/hgweb/webcommands.py Wed Sep 04 19:40:04 2013 +0400 @@ -109,6 +109,8 @@ raise inst def _search(web, req, tmpl): + MODE_REVISION = 'rev' + MODE_KEYWORD = 'keyword' def revsearch(ctx): yield ctx @@ -142,17 +144,17 @@ yield ctx searchfuncs = { - 'rev': revsearch, - 'keyword': keywordsearch, + MODE_REVISION: revsearch, + MODE_KEYWORD: keywordsearch, } def getsearchmode(query): try: ctx = web.repo[query] except (error.RepoError, error.LookupError): - return 'keyword', query + return MODE_KEYWORD, query else: - return 'rev', ctx + return MODE_REVISION, ctx def changelist(**map): count = 0