문제

I've looked at a handful of the other Hg hgignore file questions, but I haven't been able to get my regex to work.

Imagine these files:

Projects/search.intrasearch/newUI/override/xslt/foo.xsl
Projects/search.intrasearch/newUI/default/
Projects/search.intrasearch/oldUI/baz/

I want to ignore the second two lines, but not the first. So, in Mercurial, I want to include files in the newUI/override directory and it's children, but that's it. In the real system, there are a bunch more directories than above, so simply excluding oldUI and default won't work. I need a method of inclusion.

This works in a regex tool, but not in Mercurial:

(?i)Projects/search\.intrasearch/(?!newUI/override).*

도움이 되었습니까?

해결책

I finally figured this out by using a combination of two regex's:

(?i)Projects/search.*?/newUI/(?!override).*
(?i)Projects/search[^/]*/(?!newUI).*

This seems to successfully exclude anything that's a sibling to newUI and anything that's a sibling to override.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top