2

I have some temp folders in my source tree. I am ignoring them all in .hgignore like below

temp/

It is ignoring all the temp folders e.g.

a/temp
b/temp
a/c/temp
b/d/temp

But I want a specific temp folder for example "a/c/temp" to include in the repository. So I excluded it in .hgignore like below.

!a/c/temp
/temp

But it is not working. "a/c/temp" folder is still being ignored. Any idea?

nhrobin
  • 873
  • 2
  • 7
  • 14
  • take a look at the following question [http://stackoverflow.com/questions/1248570/git-ignore-everything-except-subdirectory](http://stackoverflow.com/questions/1248570/git-ignore-everything-except-subdirectory); it is for git, but it could work for mercurial – lombardo Oct 02 '14 at 14:31

1 Answers1

3

You need something like that (Negative Lookahead):

syntax: regexp
^(?!a/c).*/temp

and if you want to exlude more directories, for example b/d/temp

syntax: regexp
^(?!a/c|b/d).*/temp

I hope that helps.

sotcha
  • 923
  • 7
  • 15