diff --git a/mercurial/fileset.py b/mercurial/fileset.py
--- a/mercurial/fileset.py
+++ b/mercurial/fileset.py
@@ -136,6 +136,9 @@ def minusset(mctx, x, y):
     yl = set(getset(mctx, y))
     return [f for f in xl if f not in yl]
 
+def negateset(mctx, x):
+    raise error.ParseError(_("can't use negate operator in this context"))
+
 def listset(mctx, a, b):
     raise error.ParseError(_("can't use a list in this context"),
                            hint=_('see hg help "filesets.x or y"'))
@@ -523,6 +526,7 @@ methods = {
     'and': andset,
     'or': orset,
     'minus': minusset,
+    'negate': negateset,
     'list': listset,
     'group': getset,
     'not': notset,
diff --git a/tests/test-fileset.t b/tests/test-fileset.t
--- a/tests/test-fileset.t
+++ b/tests/test-fileset.t
@@ -68,6 +68,17 @@ Test invalid syntax
     None)
   hg: parse error: not a symbol
   [255]
+  $ fileset -v -- '-x'
+  (negate
+    (symbol 'x'))
+  hg: parse error: can't use negate operator in this context
+  [255]
+  $ fileset -v -- '-()'
+  (negate
+    (group
+      None))
+  hg: parse error: can't use negate operator in this context
+  [255]
 
 Test files status