Mercurial .hgignore file: is it possible to hide extensions in some directories but not others?

390 Views Asked by At

We are using Mercurial for keeping track of a number of linguistic papers. We want to keep our source files in Mercurial. The source files are mostly in XML, but the output file is in PDF. Therefore, we have added glob:*.pdf to our .hgignore file. Among our source files, we also have graphic files with extensions like .jpg, .png, and .svg. Recently, we've also added .pdf files as graphic files. Naturally, these PDF graphic files are not showing up when we do a hg status command.

So my question is this: is there a way to create a .hgignore pattern that will ignore *.pdf files in most directories but still show *.pdf in specified directories (directories where we store our graphic files)?

1

There are 1 best solutions below

0
On

There's a good example which does nearly what you want in the Mercurial wiki.

Quote from the link:

/target/.*\.o$

This would match all files ending with .o below (within and in subdirectories at any depth of) the target directory.

If the number of directories where you want to ignore PDF files is somewhat limited (and not: "ignore *.pdf in all directories but this one"), you can use this solution.