# HG changeset patch # User liscju # Date 1447876532 -3600 # Node ID ceef5fb14872909757d4c4a0e2c6115579308b68 # Parent 0c8ef79b9fd7aa3f584f4008a7f0d2c3b523298b fileset: add missing() predicate (issue4925) Help of status cmd defines status file of 'missing', what is called in fileset 'deleted'. To stay consistent this patch introduces missing() predicate which in fact is alias to 'deleted'. diff -r 0c8ef79b9fd7 -r ceef5fb14872 mercurial/fileset.py --- a/mercurial/fileset.py Tue Nov 10 17:22:40 2015 +0800 +++ b/mercurial/fileset.py Wed Nov 18 20:55:32 2015 +0100 @@ -159,13 +159,22 @@ def deleted(mctx, x): """``deleted()`` - File that is deleted according to :hg:`status`. + Alias for ``missing()``. """ # i18n: "deleted" is a keyword getargs(x, 0, 0, _("deleted takes no arguments")) s = mctx.status().deleted return [f for f in mctx.subset if f in s] +def missing(mctx, x): + """``missing()`` + File that is missing according to :hg:`status`. + """ + # i18n: "missing" is a keyword + getargs(x, 0, 0, _("missing takes no arguments")) + s = mctx.status().deleted + return [f for f in mctx.subset if f in s] + def unknown(mctx, x): """``unknown()`` File that is unknown according to :hg:`status`. These files will only be @@ -441,6 +450,7 @@ 'grep': grep, 'ignored': ignored, 'hgignore': hgignore, + 'missing': missing, 'modified': modified, 'portable': portable, 'removed': removed, @@ -511,7 +521,7 @@ # do we need status info? if (_intree(['modified', 'added', 'removed', 'deleted', - 'unknown', 'ignored', 'clean'], tree) or + 'missing', 'unknown', 'ignored', 'clean'], tree) or # Using matchctx.existing() on a workingctx requires us to check # for deleted files. (ctx.rev() is None and _intree(_existingcallers, tree))): diff -r 0c8ef79b9fd7 -r ceef5fb14872 tests/test-fileset-generated.t --- a/tests/test-fileset-generated.t Tue Nov 10 17:22:40 2015 +0800 +++ b/tests/test-fileset-generated.t Wed Nov 18 20:55:32 2015 +0100 @@ -47,6 +47,13 @@ ! missing_content2_missing-tracked ! missing_missing_missing-tracked + $ hg st -A 'set:missing()' + ! content1_content1_missing-tracked + ! content1_content2_missing-tracked + ! content1_missing_missing-tracked + ! missing_content2_missing-tracked + ! missing_missing_missing-tracked + $ hg st -A 'set:unknown()' ? content1_missing_content1-untracked ? content1_missing_content3-untracked diff -r 0c8ef79b9fd7 -r ceef5fb14872 tests/test-fileset.t --- a/tests/test-fileset.t Tue Nov 10 17:22:40 2015 +0800 +++ b/tests/test-fileset.t Wed Nov 18 20:55:32 2015 +0100 @@ -73,6 +73,8 @@ a2 $ fileset 'deleted()' a1 + $ fileset 'missing()' + a1 $ fileset 'unknown()' c3 $ fileset 'ignored()'