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

  • We Won The One Award I Actually Care About

    Full Scale made the Inc. 5000 for the fifth year straight, the 12th listing across my three companies. Here is why the one award you cannot buy is worth stopping for.

  • Your Customers Build the Features Now

    I let a tool I liked sit dead for a year rather than build the features I wanted. An MCP server meant I never had to, and your customers can do the same to your product.

  • Get the Size of a Directory in Linux the Easy Way

    du -sh for the quick answer, ncdu for the cleanup, df for the disk itself: every command for checking directory size in Linux, plus why du and df never agree.

  • Vim Search and Replace: The Ultimate Guide

    One :%s command replaces every match in a file before a find dialog would even open. The Vim substitute patterns worth the muscle memory: flags, ranges, capture groups, and multi-file edits.