# HG changeset patch # User Yuya Nishihara # Date 1532157404 -32400 # Node ID 3ea6ce609747a500e6d56190063688ee25bd1fd8 # Parent 48fc2a8af345d819854f8cbd15cd26049750ee92 fileset: reject 'negate' node early while transforming parsed tree That's how a 'negate' node is processed in revset. diff -r 48fc2a8af345 -r 3ea6ce609747 mercurial/fileset.py --- a/mercurial/fileset.py Sat Jul 21 16:13:30 2018 +0900 +++ b/mercurial/fileset.py Sat Jul 21 16:16:44 2018 +0900 @@ -62,9 +62,6 @@ ym = getmatch(mctx, y) return matchmod.differencematcher(xm, ym) -def negatematch(mctx, x): - raise error.ParseError(_("can't use negate operator in this context")) - def listmatch(mctx, *xs): raise error.ParseError(_("can't use a list in this context"), hint=_('see \'hg help "filesets.x or y"\'')) @@ -436,7 +433,6 @@ 'and': andmatch, 'or': ormatch, 'minus': minusmatch, - 'negate': negatematch, 'list': listmatch, 'not': notmatch, 'func': func, diff -r 48fc2a8af345 -r 3ea6ce609747 mercurial/filesetlang.py --- a/mercurial/filesetlang.py Sat Jul 21 16:13:30 2018 +0900 +++ b/mercurial/filesetlang.py Sat Jul 21 16:16:44 2018 +0900 @@ -144,7 +144,9 @@ return (op, x[1], t) if op == 'group': return _analyze(x[1]) - if op in {'not', 'negate'}: + if op == 'negate': + raise error.ParseError(_("can't use negate operator in this context")) + if op == 'not': t = _analyze(x[1]) return (op, t) if op in {'and', 'minus'}: diff -r 48fc2a8af345 -r 3ea6ce609747 mercurial/minifileset.py --- a/mercurial/minifileset.py Sat Jul 21 16:13:30 2018 +0900 +++ b/mercurial/minifileset.py Sat Jul 21 16:16:44 2018 +0900 @@ -65,8 +65,6 @@ func1 = _compile(tree[1]) func2 = _compile(tree[2]) return lambda n, s: func1(n, s) and not func2(n, s) - elif op == 'negate': - raise error.ParseError(_("can't use negate operator in this context")) elif op == 'list': raise error.ParseError(_("can't use a list in this context"), hint=_('see \'hg help "filesets.x or y"\''))