changeset 38827:48fc2a8af345

fileset: drop 'group' node from tree to be evaluated This helps rewriting a parsed tree.
author Yuya Nishihara <yuya@tcha.org>
date Sat, 21 Jul 2018 16:13:30 +0900
parents 6371ab78c3b3
children 3ea6ce609747
files mercurial/fileset.py mercurial/filesetlang.py mercurial/minifileset.py tests/test-fileset.t
diffstat 4 files changed, 10 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/fileset.py	Sat Jul 21 16:11:36 2018 +0900
+++ b/mercurial/fileset.py	Sat Jul 21 16:13:30 2018 +0900
@@ -438,7 +438,6 @@
     'minus': minusmatch,
     'negate': negatematch,
     'list': listmatch,
-    'group': getmatch,
     'not': notmatch,
     'func': func,
 }
--- a/mercurial/filesetlang.py	Sat Jul 21 16:11:36 2018 +0900
+++ b/mercurial/filesetlang.py	Sat Jul 21 16:13:30 2018 +0900
@@ -142,7 +142,9 @@
         getsymbol(x[1])  # kind must be a symbol
         t = _analyze(x[2])
         return (op, x[1], t)
-    if op in {'group', 'not', 'negate'}:
+    if op == 'group':
+        return _analyze(x[1])
+    if op in {'not', 'negate'}:
         t = _analyze(x[1])
         return (op, t)
     if op in {'and', 'minus'}:
--- a/mercurial/minifileset.py	Sat Jul 21 16:11:36 2018 +0900
+++ b/mercurial/minifileset.py	Sat Jul 21 16:13:30 2018 +0900
@@ -49,8 +49,6 @@
         return lambda n, s: func1(n, s) and func2(n, s)
     elif op == 'not':
         return lambda n, s: not _compile(tree[1])(n, s)
-    elif op == 'group':
-        return _compile(tree[1])
     elif op == 'func':
         symbols = {
             'all': lambda n, s: True,
--- a/tests/test-fileset.t	Sat Jul 21 16:11:36 2018 +0900
+++ b/tests/test-fileset.t	Sat Jul 21 16:13:30 2018 +0900
@@ -173,14 +173,13 @@
   (or
     (symbol 'a1')
     (symbol 'a2')
-    (group
-      (and
-        (func
-          (symbol 'grep')
-          (string 'b'))
-        (func
-          (symbol 'clean')
-          None))))
+    (and
+      (func
+        (symbol 'grep')
+        (string 'b'))
+      (func
+        (symbol 'clean')
+        None)))
   * matcher:
   <unionmatcher matchers=[
     <patternmatcher patterns='(?:a1$)'>,