ignoring folders in mercurial

user2427 picture user2427 · Nov 21, 2008 · Viewed 22.5k times · Source

Caveat: I try all the posibilities listed here: How can I ignore everything under a folder in Mercurial.
None works as I hope.

I want to ignore every thing under the folder test. But not ignore srcProject\test\TestManager

I try

syntax: glob
test/**

And it ignores test and srcProject\test\TestManager

With:

syntax: regexp
^/test/

It's the same thing.

Also with:

syntax: regexp
test\\*

I have install TortoiseHG 0.4rc2 with Mercurial-626cb86a6523+tortoisehg, Python-2.5.1, PyGTK-2.10.6, GTK-2.10.11 in Windows

Answer

Ry4an Brase picture Ry4an Brase · Nov 24, 2008

Try it without the slash after the caret in the regexp version.

^test/

Here's a test:

~$ mkdir hg-folder-ignore
~$ cd hg-folder-ignore
~/hg-folder-ignore$ echo '^test/' > .hgignore
~/hg-folder-ignore$ hg init
~/hg-folder-ignore$ mkdir test
~/hg-folder-ignore$ touch test/ignoreme
~/hg-folder-ignore$ mkdir -p srcProject/test/TestManager
~/hg-folder-ignore$ touch srcProject/test/TestManager/dont-ignore
~/hg-folder-ignore$ hg stat
? .hgignore
? srcProject/test/TestManager/dont-ignore

Notice that ignoreme isn't showing up and dont-ignore is.