I have a problem which I can\'t seem to understand. I\'m using TortoiseHg (version 0.7.5) on Windows but on Linux I have the same problem. Here it is:
My .hgignore
I relayed this question in #mercurial
on irc.freenode.net and the response was that you cannot distinguish between files and directories — the directory is matched without the slash that you're searching for in your regexp.
However, if you can assume that your directories will never contain a full-stop .
, but your files will, then something like this seems to work:
^[^/]*\..*$
I tested it in a repository like this:
% hg status -ui ? a.txt ? bbb ? foo/x.txt ? foo/yyy
Adding the .hgignore
file gives:
% hg status -ui ? bbb ? foo/x.txt ? foo/yyy I .hgignore I a.txt
which indicates that the a.txt
file is correctly ignored in your root directory, but x.txt
in the foo
subdirectory is not. You can also see that a file named just bbb
in the root directory is not ignored. But maybe you can add such files yourself to the .hgignore
file.
If you happen to have a directory like bar.baz
in your root directory, then this directory and all files within will be ignored. I hope this helps a bit.
Here is a dirty trick:
Create an empty file ".hidden" in your directory, than add to .hgignore:
^mydir/(?!\.hidden).+$
This will ignore all files in the directory except ".hidden".