Mercurial.hgignore negative lookbehind regex

I am trying to ignore everything except the "test.ext" file in the "data" directory and all of its subdirectories. however, when I put hgignore:

syntax: regexp
^data\/.*(?<!\/test\.ext)$

      

He only ignores

data\test.ext

      

And does not ignore:

data\images\test.ext

      

+3


source to share


2 answers


If no new subdirectories appear, then you are much better off just ignoring data

then the hg add

files test.ext

you want to track. Adding a file overrides ignore by 100%, and running find data -name test.ext | xargs hg add

once in a blue moon is better than a tortured regex.



+4


source


From hg docs : "There is no easy way to ignore everything but a set of files. Attempting to use an inverted regex match will fail when combined with other patterns. This is an intentional limitation, as all alternative formats are considered too likely to confuse users and is worth the extra flexibility."



0


source







All Articles