In my mercurial.ini file, I call a global hgignore file like this:
[ui]
ignore = ~/hgignore.ini
This refers to a hgignore.ini file which is in the same directory as the mercurial.ini file.
By global hgignore with relevant sections marked, I mean:
syntax: glob
# VISUAL STUDIO
*.obj
*.pdb
*.suo
[Bb]in
[Dd]ebug*/
[Rr]elease*/
# TEMPORARY FILES
*.log
*.bak
*.cache
The global .hgignore
is "added" to the local one. This means that everything in the global one will be considered for each repository, but the content of the local one will also be considered.
For the second question, I think the best answer is : it depends on what you want ;)
In my case, I use both of them. The global .hgignore
contains project files (Visual Studio, Netbeans), backup files (.bak, vim), libraries (dll, so, etc). And for each project, I put whatever is specific in the local file.