Mercurial > public > mercurial-scm > hg
diff tests/test-fileset.t @ 38689:ff5b6fca1082
fileset: rewrite predicates to return matcher not closed to subset (API) (BC)
This makes fileset expression open to any input, so that we can just say
"hg status 'set: not binary()'" to select text files including unknowns.
With this and removal of subset computation, 'set:**' becomes as fast as
'glob:**'. Further optimization will probably be possible by narrowing the
file tree to compute status for example.
This also fixes 'subrepo()' to not ignore the current mctx.subset.
.. bc::
The fileset expression may include untracked files by default. Use
``tracked()`` to explicitly filter out files not existing at the context
revision.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sat, 09 Jun 2018 19:55:10 +0900 |
parents | 131aae58a316 |
children | 5d9749c598f0 |
line wrap: on
line diff
--- a/tests/test-fileset.t Tue Jul 10 23:49:48 2018 +0900 +++ b/tests/test-fileset.t Sat Jun 09 19:55:10 2018 +0900 @@ -142,8 +142,10 @@ .hgignore c2 $ fileset 'hgignore()' + .hgignore a2 b2 + c2 $ fileset 'clean()' b1 $ fileset 'copied()' @@ -182,6 +184,7 @@ >>> open('bin', 'wb').write(b'\0a') and None $ fileset 'binary()' + bin $ fileset 'binary() and unknown()' bin $ echo '^bin$' >> .hgignore @@ -192,6 +195,7 @@ bin $ fileset 'grep("b{1}")' + .hgignore b1 b2 c1 @@ -354,8 +358,12 @@ $ fileset -r1 'unknown()' $ fileset -r1 'ignored()' $ fileset -r1 'hgignore()' + .hgignore + a2 b2 bin + c2 + sub2 $ fileset -r1 'binary()' bin $ fileset -r1 'size(1k)' @@ -403,30 +411,42 @@ dos mixed $ fileset 'eol(unix)' + .hgignore .hgsub .hgsubstate b1 b2 + b2.orig c1 + c2 + c3 + con.xml mixed + unknown $ fileset 'eol(mac)' mac Test safety of 'encoding' on removed files $ fileset 'encoding("ascii")' + .hgignore .hgsub .hgsubstate 1k 2k b1 b2 + b2.orig b2link (symlink !) bin c1 + c2 + c3 + con.xml dos mac mixed + unknown Test detection of unintentional 'matchctx.existing()' invocation @@ -437,7 +457,8 @@ > @filesetpredicate(b'existingcaller()', callexisting=False) > def existingcaller(mctx, x): > # this 'mctx.existing()' invocation is unintentional - > return [f for f in mctx.existing()] + > existing = set(mctx.existing()) + > return mctx.predicate(existing.__contains__, cache=False) > EOF $ cat >> .hg/hgrc <<EOF