문제

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

다른 팁

The following run in the root directory of your repository:

cat ./.hgignore 

or on windows:

type .\.hginore

Will display your repositories ignore rules.

This can consist of glob and or regex patterns and specific file names, for the glob section any path ending with / will ignore the entire directory and any sub directories, pattern of the format *.ext will ignore that extension in all subdirectories, dir/*.ext will ignore that extension in sub-directories as specified, etc.

It is worth manually re-factoring this file occasionally as you may find that there are numerous individual files ignored that are better as a pattern or directory ignore.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top