Roberto Aloi
Roberto Aloi

Reputation: 30995

Ignoring everything but a subfolder in Mercurial

I want to ignore everything BUT a subfolder in Mercurial.

The folder I want to keep:

a/b/c/d/e/f

Everything else under:

a/b

Should be ignored.

I'm using regexp mode in the .hgignore file. This is what I've so far:

a/b/(?!c)
a/b/c/(?!d)
a/b/c/d/(?!e)
a/b/c/d/e/(?!f)

Even if this works fine, I would like to shrink it to a single line:

a/b/(?!c/d/e/f)

Except this doesn't work. I tried to escape the slashes in several ways, but it didn't help.

Any hint?

Upvotes: 3

Views: 289

Answers (4)

Ry4an Brase
Ry4an Brase

Reputation: 78350

You probably know this already, but you can just add the stuff in a/b/c/d/e/f without adding an exception to the .hgignore. It's not perfect, you have to remember to add any new files, but I thought I'd mention it since it's non-obvious to we CVS/SVN refugees.

Upvotes: 1

Joe Schneider
Joe Schneider

Reputation: 9339

Why not just create the hg repo in a/b/c/d/e/f?

Upvotes: 0

Tomalak
Tomalak

Reputation: 338406

^a/b/(?!c/d/e/f).*$

Upvotes: 0

Kimvais
Kimvais

Reputation: 39628

have you tried this:

a/b/(?!c).*

Upvotes: 1

Related Questions