Ignore files in Mercurial using Glob syntax

Danilo Puric picture Danilo Puric · Jul 22, 2010 · Viewed 7.7k times · Source

I'm using Mercurial and I have a following structure:

files
   test
       demo.jpg
       video.flv
       video.doc

   sport
       demo2.jpg
       picture.jpg
       text.txt
demo3.jpg
demofile3.doc

I want to make a glob filter that only ignore all "jpg" files in all directory that are children of "files" directory

I tried with files/*.jpg but it doesn't work.

Any advice would be appreciated.

Answer

Chris McCauley picture Chris McCauley · Jul 22, 2010

Regexp solution


This works for me ..

syntax: regexp
files/.*/.*jpg


Your own solution looks more like a glob. The trick with that is to use the ** syntax to allow for sub directories. See this ...

Glob solution


This glob works for me too

**/files/**/*.jpg


Comments

Personally I'd always go with the glob syntx for this kind of problem. Once you know about the ** syntax, it's easier than a regexp to follow what the pattern is trying to do.