Way to include one .hgignore file in another

200 Views Asked by At

Is there any way to include one .hgignore file in another?

e.g., say I have a common .hgignore file in a Mercurial subrepository (named hg-common) that ignores files like desktop.ini & .DS_Store, and I want to include that file in every project that I create. In my .hgignore of my project1 repo, I want to do something like:

syntax: include hg-common/.hgignore

with syntax: include being my imaginary syntax for including the specified file.

2

There are 2 best solutions below

2
XDR On BEST ANSWER

I found the correct syntax:

include:hg-common/.hgignore
0
barjak On

You can use either include or subinclude:

include:hg-common/.hgignore
subinclude:hg-common/.hgignore

The difference is that subinclude confines its effect to the hg-common directory, whereas include applies the patterns globally.