How to hgignore all files of a particular extension except in one directory and its subdirectories?

StackOverflow https://stackoverflow.com/questions/18547754

  •  26-06-2022
  •  | 
  •  

문제

I would like to use the .hgignore file of Mercurial to ignore all files with file extension .tex, except those .tex files in one particular directory and whatever subdirectory of this directory.

I presume syntax: regexp will be required for this. A brief explanation of the particular regular expression used, would also be very welcome, so that we can all learn a bit here.

도움이 되었습니까?

해결책

Let's say you want to exclude the directory named exclude. The following regex would then match all files that end in .tex unless exclude/ comes somewhere before that:

^(?!.*\bexclude/).*\.tex$
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top