hg st -i
shows all ignored files. This can be a huge list if I'm ignoring some external libs. Is it possible to see just the directories under which files have been ignored? Or some other way to neatly summarize which files/directories have been ignored ?
If you're on Unix (Linux/OS X), you can easily generate a listing of the directories containing ignored files with the one-liner below.
% hg status -i
I .project
I project/doc/API-notes.bbl
I project/doc/API-notes.blg
I project/doc/API-notes.log
% hg status -ni | sed -e 's/^/.\//' -e 's/\/[^\/]*$/\//' | sort | uniq -c
1 ./
3 ./project/doc/
The first sed
expression adds ./
in front
of each ignored path. The second expression deletes everything after the final slash. I restore the slash on purpose; leave it out if you prefer. Finally, sort | uniq -c
counts and removes repetitions.
PS. You could turn the above into an hg alias, so that you can, for example, run it with hg ignoredirs
; just put the following in your .hgrc
:
[alias]
ignoredirs = !$HG status -ni | sed -e 's/^/.\//' -e 's/\/[^\/]*$/\//' | sort | uniq -c