Patchwork [3,of,3] revset: add public function to create matcher from evaluatable tree

login
register
mail settings
Submitter Yuya Nishihara
Date Sept. 7, 2016, 2:44 p.m.
Message ID <8e55b08612217849ba56.1473259457@mimosa>
Download mbox | patch
Permalink /patch/16573/
State Accepted
Headers show

Comments

Yuya Nishihara - Sept. 7, 2016, 2:44 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1471747020 -32400
#      Sun Aug 21 11:37:00 2016 +0900
# Node ID 8e55b08612217849ba56dbb921db704073a8e193
# Parent  eab0f0cbd818cc2bb325cac0e7d61483b63d5ae6
revset: add public function to create matcher from evaluatable tree

"hg debugrevspec" will use it to evaluate unoptimized tree.
Augie Fackler - Sept. 7, 2016, 7:25 p.m.
On Wed, Sep 07, 2016 at 11:44:17PM +0900, Yuya Nishihara wrote:
> # HG changeset patch
> # User Yuya Nishihara <yuya@tcha.org>
> # Date 1471747020 -32400
> #      Sun Aug 21 11:37:00 2016 +0900
> # Node ID 8e55b08612217849ba56dbb921db704073a8e193
> # Parent  eab0f0cbd818cc2bb325cac0e7d61483b63d5ae6
> revset: add public function to create matcher from evaluatable tree

Queued these, thanks

>
> "hg debugrevspec" will use it to evaluate unoptimized tree.
>
> diff --git a/mercurial/revset.py b/mercurial/revset.py
> --- a/mercurial/revset.py
> +++ b/mercurial/revset.py
> @@ -2615,15 +2615,17 @@ def matchany(ui, specs, repo=None):
>          tree = parse(specs[0], lookup)
>      else:
>          tree = ('or',) + tuple(parse(s, lookup) for s in specs)
> -    return _makematcher(ui, tree, repo)
> -
> -def _makematcher(ui, tree, repo):
> +
>      if ui:
>          tree = expandaliases(ui, tree, showwarning=ui.warn)
>      tree = foldconcat(tree)
>      tree = analyze(tree)
>      tree = optimize(tree)
>      posttreebuilthook(tree, repo)
> +    return makematcher(tree)
> +
> +def makematcher(tree):
> +    """Create a matcher from an evaluatable tree"""
>      def mfunc(repo, subset=None):
>          if subset is None:
>              subset = fullreposet(repo)
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Patch

diff --git a/mercurial/revset.py b/mercurial/revset.py
--- a/mercurial/revset.py
+++ b/mercurial/revset.py
@@ -2615,15 +2615,17 @@  def matchany(ui, specs, repo=None):
         tree = parse(specs[0], lookup)
     else:
         tree = ('or',) + tuple(parse(s, lookup) for s in specs)
-    return _makematcher(ui, tree, repo)
-
-def _makematcher(ui, tree, repo):
+
     if ui:
         tree = expandaliases(ui, tree, showwarning=ui.warn)
     tree = foldconcat(tree)
     tree = analyze(tree)
     tree = optimize(tree)
     posttreebuilthook(tree, repo)
+    return makematcher(tree)
+
+def makematcher(tree):
+    """Create a matcher from an evaluatable tree"""
     def mfunc(repo, subset=None):
         if subset is None:
             subset = fullreposet(repo)