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

login
register
mail settings
Submitter Alexander Plavin
Date July 14, 2013, 9:45 p.m.
Message ID <bca776abd68589345108.1373838328@debian-alexander.dolgopa>
Download mbox | patch
Permalink /patch/1894/
State Superseded
Headers show

Comments

Alexander Plavin - July 14, 2013, 9:45 p.m.
# HG changeset patch
# User Alexander Plavin <me@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.
Matt Mackall - July 19, 2013, 4:40 a.m.
On Mon, 2013-07-15 at 01:45 +0400, Alexander Plavin wrote:
> # HG changeset patch
> # User Alexander Plavin <me@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

Please resend these after Aug 1.

Patch

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