Patchwork [2,of,3,V2] hgweb: search() function supports direct pointing to revision

login
register
mail settings
Submitter Alexander Plavin
Date Aug. 16, 2013, 8 p.m.
Message ID <f36e11723a01737156e3.1376683245@debian-alexander.dolgopa>
Download mbox | patch
Permalink /patch/2182/
State Superseded
Headers show

Comments

Alexander Plavin - Aug. 16, 2013, 8 p.m.
# HG changeset patch
# User Alexander Plavin <alexander@plav.in>
# 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.

Patch

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