per-directory .hgignore?

Peter Hosey boredzo at gmail.com
Wed Apr 1 07:59:41 CDT 2009


On Apr 01, 2009, at 05:29:09, Neal Becker wrote:
> Can I have a per-directory (not repo-wide) .hgignore?

According to the hgignore(5) manpage, the file can only exist at the  
root of the repository. And it doesn't mention any way to include  
another ignore file.

You can get the same effect by making a repo-wide .hgignore and  
putting root-relative paths in it:

syntax: regexp
# Only ignore *.o files in foo/bar
^foo/bar/.*\.o

Note the ^, which anchors the match at the start of the relative path.  
This expression won't match qux/foo/bar/bar.o, only foo/bar/bar.o. You  
can't get this with the glob syntax.

You may be able to set other ignore files in the repository's hgrc  
file, but that isn't versioned and Mercurial won't exchange it with  
your fellow developers (for good reasons already noted on this list).



More information about the Mercurial mailing list