From patchwork Fri Aug 16 20:00:45 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [2, of, 3, V2] hgweb: search() function supports direct pointing to revision From: Alexander Plavin X-Patchwork-Id: 2182 Message-Id: To: mercurial-devel@selenic.com Date: Sat, 17 Aug 2013 00:00:45 +0400 # HG changeset patch # User Alexander Plavin # Date 1374187271 -14400 # Fri Jul 19 02:41:11 2013 +0400 # Node ID f36e11723a01737156e3a79887a6b7ccc8fa6ed0 # Parent 7de4329371abefa30c9776084d54fd1cb9e0e6c3 hgweb: search() function supports direct pointing to revision This doesn't change the behavior, as queries directly pointing to revisions are not delegated to the search() function now. diff -r 7de4329371ab -r f36e11723a01 mercurial/hgweb/webcommands.py --- a/mercurial/hgweb/webcommands.py Fri Aug 16 15:35:44 2013 +0400 +++ b/mercurial/hgweb/webcommands.py Fri Jul 19 02:41:11 2013 +0400 @@ -110,6 +110,9 @@ def _search(web, req, tmpl): + def revsearch(): + yield web.repo[query] + def keywordsearch(): lower = encoding.lower qw = lower(query).split() @@ -139,11 +142,17 @@ yield ctx searchfuncs = { + 'rev': revsearch, 'kw': keywordsearch, } def getsearchmode(): - return 'kw' + try: + web.repo[query] + except (error.RepoError, error.LookupError): + return 'kw' + else: + return 'rev' def changelist(**map): count = 0