[PATCH] fileset: add missing() predicate (issue4925)

Piotr Listkiewicz piotr.listkiewicz at gmail.com
Thu Nov 19 01:45:37 CST 2015


>
> Can we have the help of one to be a direct reference to the other (eg:
> alias for 'missing') as we do for other alias.
> Personally, I'm in favor of using "missing" as the main entry as it is the
> one put the most forward in the `hg status help`


Done in Patch V2

2015-11-18 22:54 GMT+01:00 Pierre-Yves David <pierre-yves.david at ens-lyon.org
>:

>
>
> On 11/18/2015 11:57 AM, liscju wrote:
>
>> # HG changeset patch
>> # User liscju <piotr.listkiewicz at gmail.com>
>> # Date 1447876532 -3600
>> #      Wed Nov 18 20:55:32 2015 +0100
>> # Node ID 5dfcb90fea7c360905bb2eb3816eadef48c2b405
>> # Parent  2da6a2dbfc42bdec4bcaf47da947c64ff959a59c
>> 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'.
>>
>
>
> Can we have the help of one to be a direct reference to the other (eg:
> alias for 'missing') as we do for other alias.
>
> Personally, I'm in favor of using "missing" as the main entry as it is the
> one put the most forward in the `hg status help`
>
> diff -r 2da6a2dbfc42 -r 5dfcb90fea7c mercurial/fileset.py
>> --- a/mercurial/fileset.py      Mon Nov 09 17:20:50 2015 -0500
>> +++ b/mercurial/fileset.py      Wed Nov 18 20:55:32 2015 +0100
>> @@ -166,6 +166,15 @@
>>       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 2da6a2dbfc42 -r 5dfcb90fea7c tests/test-fileset-generated.t
>> --- a/tests/test-fileset-generated.t    Mon Nov 09 17:20:50 2015 -0500
>> +++ 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 2da6a2dbfc42 -r 5dfcb90fea7c tests/test-fileset.t
>> --- a/tests/test-fileset.t      Mon Nov 09 17:20:50 2015 -0500
>> +++ 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()'
>> _______________________________________________
>> Mercurial-devel mailing list
>> Mercurial-devel at selenic.com
>> https://selenic.com/mailman/listinfo/mercurial-devel
>>
>>
> --
> Pierre-Yves David
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20151119/d5efa8b8/attachment.html>


More information about the Mercurial-devel mailing list