Using Mercurial, I need to ignore all files and directories except directories "tests" and "languages" and files in those directories. That all must be done with regex and .hgignoere
Files:
I tried with this:
^(?!test|test/|test$|languages|languages/|languages$)
but this only matches the files that starts with test and language:
What I want is to matches also
Any advice would be appreciated.
Use globs, they're simpler:
C:> dir
tests languages pr0n espionage more_pr0n
C:> type .hgignore
syntax: glob
pr0n/*
espionage/*
more_pr0n/*
added: If you are concerned that there will be new directories that won't be ignored then you should:
hg add .hgignore
hg commit
echo "new_directory/*" >> .hgignore
hg commit
If you have too many directories and files popping up in your source directory for this method to work, make a source-only directory.