[PATCH] purge: add --ignored-only/-i option to delete only ignored files
Patrick Mézard
patrick at mezard.eu
Fri Apr 6 02:43:55 CDT 2012
Le 05/04/12 23:45, Matt Mackall a écrit :
> On Thu, 2012-04-05 at 09:43 +0200, Patrick Mézard wrote:
>> Le 22/03/12 20:22, Matt Mackall a écrit :
>>> On Wed, 2012-03-21 at 21:49 -0400, Greg Ward wrote:
>>>> On 21 March 2012, Matt Mackall said:
>>>>> On Tue, 2012-03-20 at 21:50 -0400, Greg Ward wrote:
>>>>> Does this work?
>>>>>
>>>>> hg purge "set:ignored()"
>>>>
>>>> No, but
>>>>
>>>> hg purge --all "set:ignored()"
>>>>
>>>> Also, this does not remove empty directories.
>>>
>>> Seems buggy.
>>
>> purge behaviour with match objects is unique, it applies them to directories as well. The code looks like:
>>
>> - Call repo.status(match) and collect directory trees with match.dir().
>> - Remove unknown and possibly ignored files
>> - Remove collected directory entries *matched* by the matcher object.
>>
>> For instance:
>>
>> $ hg init repo
>> $ cd repo
>> $ mkdir -p dir/subdir
>> $ touch dir/subdir/file
>> $ hg purge -v dir/subdir
>> Removing file dir/subdir/file
>> Removing directory dir/subdir
>>
>> Note that "dir" was not removed because it is not matched by "dir/subdir".
>>
>> Looking at the code history, this behaviour is at least partially by
>> design, to let people ignore empty directories using --exclude.
>
> Meh, since when have we cared about empty directories?
At least May 2007, I haven't looked before:
http://selenic.com/hg/rev/a73cf208b2a0
--
Patrick Mézard
More information about the Mercurial-devel
mailing list