--- a/tests/test-fileset.t Mon Dec 21 22:31:16 2015 +0900
+++ b/tests/test-fileset.t Mon Dec 21 22:31:16 2015 +0900
@@ -328,3 +328,22 @@
b2link
bin
c1
+
+Test detection of unintentional 'matchctx.existing()' invocation
+
+ $ cat > $TESTTMP/existingcaller.py <<EOF
+ > from mercurial import fileset
+ >
+ > @fileset.predicate('existingcaller()', callexisting=False)
+ > def existingcaller(mctx, x):
+ > # this 'mctx.existing()' invocation is unintentional
+ > return [f for f in mctx.existing()]
+ > EOF
+
+ $ cat >> .hg/hgrc <<EOF
+ > [extensions]
+ > existingcaller = $TESTTMP/existingcaller.py
+ > EOF
+
+ $ fileset 'existingcaller()' 2>&1 | tail -1
+ AssertionError: unexpected existing() invocation