[PATCH 3 of 4 RFC] hgweb: add revsetsearch function, which will be used later

Alexander Plavin me at aplavin.ru
Sun Jul 14 21:45:28 UTC 2013


# HG changeset patch
# User Alexander Plavin <me at aplavin.ru>
# Date 1373836419 -14400
#      Mon Jul 15 01:13:39 2013 +0400
# Node ID bca776abd685893451086701fac8b11845680b85
# Parent  8c4a2c55d87bff120c49b6c65c124f47df02a26c
hgweb: add revsetsearch function, which will be used later

Comments and advice are very appreciated, as I'm not sure if use
cmdutil.walkchangerevs optimally.

diff -r 8c4a2c55d87b -r bca776abd685 mercurial/hgweb/webcommands.py
--- a/mercurial/hgweb/webcommands.py	Mon Jul 15 01:10:22 2013 +0400
+++ b/mercurial/hgweb/webcommands.py	Mon Jul 15 01:13:39 2013 +0400
@@ -14,7 +14,7 @@
 from common import HTTP_OK, HTTP_FORBIDDEN, HTTP_NOT_FOUND
 from mercurial import graphmod, patch
 from mercurial import help as helpmod
-from mercurial import scmutil
+from mercurial import cmdutil, scmutil
 from mercurial.i18n import _
 
 # __all__ is populated with the allowed commands. Be sure to add to it if
@@ -138,6 +138,16 @@
 
             yield ctx
 
+    def revsetsearch():
+        opts = {'rev': ['reverse(%s)' % query]}
+        matchfn = scmutil.match(web.repo[None], [], opts)
+
+        def prep(ctx, fns):
+            pass
+
+        for ctx in cmdutil.walkchangerevs(web.repo, matchfn, opts, prep):
+            yield ctx
+
     def changelist(**map):
         count = 0
 



More information about the Mercurial-devel mailing list