# HG changeset patch # User Patrick Mezard # Date 1345062549 -7200 # Node ID 04c65cb594677303c3044dfe27c1c95db7ff5e1f # Parent 8a0513bf030ab55c5c2327e8462795c211b19303 fileset: matchctx.existing() must consider unknown files By default, unknown files are ignored. If the 'unknown()' predicate appears in the syntax tree, then they are taken in account. Unfortunately, matchctx.existing() was filtering against non-deleted context files, which does not include unknown files. So: $ hg debugfileset 'binary() and unknown()' would not return existing binary unknown files. diff -r 8a0513bf030a -r 04c65cb59467 mercurial/fileset.py --- a/mercurial/fileset.py Wed Aug 15 21:44:00 2012 +0200 +++ b/mercurial/fileset.py Wed Aug 15 22:29:09 2012 +0200 @@ -432,10 +432,12 @@ def existing(self): if self._status is not None: removed = set(self._status[3]) + unknown = set(self._status[4]) else: removed = set() + unknown = set() return (f for f in self.subset - if f in self.ctx and f not in removed) + if (f in self.ctx and f not in removed) or f in unknown) def narrow(self, files): return matchctx(self.ctx, self.filter(files), self._status) diff -r 8a0513bf030a -r 04c65cb59467 tests/test-fileset.t --- a/tests/test-fileset.t Wed Aug 15 21:44:00 2012 +0200 +++ b/tests/test-fileset.t Wed Aug 15 22:29:09 2012 +0200 @@ -80,4 +80,9 @@ >>> file('bin', 'wb').write('\0a') $ fileset 'binary()' + $ fileset 'binary() and unknown()' + bin + $ hg add bin + $ fileset 'binary()' + bin