1
votes

I'm using Mercurial and I would like to ignore all folders named 'build' (I have two of these), with one exception - I would like to include the folder 'build/outputs/mapping/release'

I tried to add 'build/*' to .hgignore and manually add the subfolder to my repository it using hg add build/outputs/mapping/release but it didn't work.

Any idea how can I do it in my .hgignore file?

1
Did you try build/[a-n,p-z]* instead of build/*?Hoseyn Heydari
I added 'build/[^o]' 'build/outputs/[^m]' But I was hoping for something more elegant...Asaf Pinhassi
Not sure of what you're doing, but you can explicitly add the contents of build/outputs/mapping/release. So, for example if you want to track changes to that folder, you can do something like "hg addrem build/outputs/mapping/release/*" in a scriptKevin Shea

1 Answers

1
votes

Git supports the concept of "un-ignoring" a previously listed ignore entry, with later entries overriding earlier ones. Mercurial does not, so you must come up with expressions that cover your case.

You mention that you have two particular directories to ignore, so instead of using a pattern, you can simply list them:

^build/ignore1/
^build/ignore2/

for instance. For more complex cases, you can either enumerate them all, or come up with a pattern that matches the desired paths, as you did in your comment.