You must put the file in the root of your repository.
See:
He says :
These files can be ignored by specifying them in the .hgignore file in the root directory of the working directory. The .hgignore file must be created manually. Usually it is under version control, so the settings will be distributed to other repositories using push and pull .
Another advantage is that you can work on multiple projects. Each of them has its own set of file templates to ignore. For example, working on a Visual Studio project or a simple C ++ project or a Python project. This ensures that patterns to be ignored are relevant to the project.
As usual , you cannot replicate these patterns in every ignore file. In this case, the Mercurial configuration file may refer to a set of files for each user or global ignore.
Example for global ignore files
in ~ / .hgrc 1 :
[ui] ignore = ~/.hgignore
in ~ / .hgignore:
syntax: glob *.tex *.R
1 On Windows: %USERPROFILE%\mercurial.ini , ~ refers to %USERPROFILE% on Windows.
pyfunc
source share