[PATCH 2 of 7] fileset: drop 'group' node from tree to be evaluated
Yuya Nishihara
yuya at tcha.org
Fri Aug 3 11:01:39 EDT 2018
# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1532157210 -32400
# Sat Jul 21 16:13:30 2018 +0900
# Node ID 9321d75764446672280a850db18ef335e4d3ee92
# Parent 78c669de8c435c0594ab4f849f591aacad074097
fileset: drop 'group' node from tree to be evaluated
This helps rewriting a parsed tree.
diff --git a/mercurial/fileset.py b/mercurial/fileset.py
--- a/mercurial/fileset.py
+++ b/mercurial/fileset.py
@@ -438,7 +438,6 @@ methods = {
'minus': minusmatch,
'negate': negatematch,
'list': listmatch,
- 'group': getmatch,
'not': notmatch,
'func': func,
}
diff --git a/mercurial/filesetlang.py b/mercurial/filesetlang.py
--- a/mercurial/filesetlang.py
+++ b/mercurial/filesetlang.py
@@ -142,7 +142,9 @@ def _analyze(x):
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'}:
diff --git a/mercurial/minifileset.py b/mercurial/minifileset.py
--- a/mercurial/minifileset.py
+++ b/mercurial/minifileset.py
@@ -49,8 +49,6 @@ def _compile(tree):
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,
diff --git a/tests/test-fileset.t b/tests/test-fileset.t
--- a/tests/test-fileset.t
+++ b/tests/test-fileset.t
@@ -173,14 +173,13 @@ Show parsed tree at stages:
(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$)'>,
More information about the Mercurial-devel
mailing list