Search code examples
regexsyntaxmercurialglobhgignore

About Mercurial, .hgignore file and glob syntax


Is it possible, while using glob syntax for an .hgignore file, to recursively ignore certain files and folders, except one?

Assuming that you have:

a/
a/b
a/c
a/d

Something like:

syntax globe:
a
^a/b

This should ideally ignore c and d and keep b.

I know this has been discussed in other SO questions, but it seems they're all using regex mode for the syntax.


Solution

  • The glob syntax is transformed to regex in match.py. It seems that this is the syntax you are looking for:

    syntax:glob
    
    a/*[!b]