Example .hgignore regarding whole directories

Mads Kiilerich mads at kiilerich.com
Wed Apr 7 18:07:54 CDT 2010


Harry Putnam wrote, On 04/07/2010 11:18 PM:
> I wasn't clear from a light (partial) reading of
>
>      `Mercurial: The Definitive Guide'
>
> What all works in `.hgignore'.
>
> There is a very light discussion in:
>    file-names-and-pattern-matching.html
>    

The hgignore man page should be an even more definitive resource (only 
second to the source) and has a very short but quite exact description.

> But it was not clear about how directories might be included or what
> impart it would have.
>
> The 2 comments there, do not help much either.
>
> Can directories be listed in `.hgignore' with the impact that
> everything beneath is ignored.
>
> If that is possible can I see some examples of the syntax?
>
> I'd prefer regular expressions but `glob' would be good too.
>    

To ignore everything in the directory foo you can match a "prefix path" 
by specifying in .hgignore:
     ^foo$
or you can get (almost) the same with:
     syntax: glob
     foo

> When ignoring file/directory names... is the slash (/) part of what
> mercurial sees, and can therefore be part of the regex?
>    

That depends on how you want to do it ... You can also make a regex that 
matches the whole path:
     ^foo/

/Mads


More information about the Mercurial mailing list