Mercurial (Hg) Global Ignore File on Windows

This took me a little bit to figure out, so hopefully this will save someone else some work.

Your mercurial configuration file should be named "mercurial.ini" and should live in %userprofile%, e.g. C:\Users\Rob\mercurial.ini.

You may name your global ignore file anything you want, e.g. hgignore.ini, and place it anywhere you like.  I prefer to keep it with my mercurial.ini file, so it also lives in %userprofile%, e.g. C:\Users\Rob\mercurial.ini.

Then you place a line in your mercurial.ini file that points to your ignore file:

[ui] username = Rob ignore = ~/hgignore.ini merge = bcomp

[extensions] extdiff =

[extdiff] cmd.bcomp = C:\Program Files (x86)\Beyond Compare 3\BComp.exe opts.bcomp = /ro

[tortoisehg] vdiff = bcomp

[merge-tools] bcomp.executable = C:\Program Files (x86)\Beyond Compare 3\BComp.exe bcomp.args = $local $other $base $output bcomp.priority = 1 bcomp.premerge = True bcomp.gui = True

The "~/" specifies your home directory.  Note that even though it uses the "/", this works fine on Windows.

Here's an example hgignore file that I borrowed.  See the links incorporated in it for the sources.  Note that I have commented out a few entries, i.e. using "#", for items that I like to check into Mercurial, e.g. *.exe and *.pdb.

# Ignore file for Visual Studio

http://blogs.planetcloud.co.uk/mygreatdiscovery/post/Mercurial-ignore-file.aspx

http://stackoverflow.com/questions/34784/mercurial-setup-for-visual-studio-2008-projects

use glob syntax

syntax: glob

Ignore Visual Studio files

*.obj #*.exe #*.pdb *.user *.aps *.pch *.vspscc *.vshost.* *_i.c *_p.c *.ncb *.suo *.tlb *.tlh *.bak *.cache *.ilk *.log *.tlog *.idb *.sdf *.opensdf *.embed.* *.intermediate.* *.lastbuildstate *_manifest.rc *.ipch *.lib *.sbr *.scc #[Bb]in #[Dd]ebug*/ obj/ #[Rr]elease*/ _ReSharper*/ [Tt]est[Rr]esult* [Bb]uild[Ll]og.* *.[Pp]ublish.xml

Good luck!

Rob

This article is part of the GWB Archives. Original Author: Rob

New on Geeks with Blogs