[PATCH] purge: add --ignored-only/-i option to delete only ignored files

Matt Mackall mpm at selenic.com
Thu Mar 22 14:22:12 CDT 2012


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:
> > > # HG changeset patch
> > > # User Greg Ward <greg at gerg.ca>
> > > # Date 1332294424 14400
> > > # Node ID bfde5bbbc3bb0d804a70cad737f0bf95086a448c
> > > # Parent  12e3f93b1cbc7c930e941f0adfe632c8ad70b73d
> > > purge: add --ignored-only/-i option to delete only ignored files
> > > 
> > > This is handy when you trust .hgignore to specify all of your build
> > > products, but you do not trust yourself to always remember to "hg add"
> > > new files. This treats unknown files as valuable, since they might
> > > become added files soon.

Ignored files may also be valuable. Config files are a common example of
things you never want to commit, but that you don't want Mercurial to
clobber. I think maybe half of projects have one or more of these.

> > Does this work?
> > 
> >  hg purge "set:ignored()"
> 
> No, but
> 
>   hg purge --all "set:ignored()" 

Hmm, perhaps we should fix that.

> Also, this does not remove empty directories.

Seems buggy.

> However, this totally fails the usability test. I can just see me
> trying to explain to one of my co-workers how to clean up a messy
> working dir.

The easy/safe way, of course, is 'hg clone'.

-- 
Mathematics is the supreme nostalgia of our time.




More information about the Mercurial-devel mailing list