How to set up Mercurial on Windows

Mercurial is an excellent lightweight distributed revision control system that makes software development (and web development!) easier. Even though it is used by organisations with large projects such as the Mozilla Foundation, OpenSolaris and OpenJDK, it is not obvious how to set it up on Microsoft Windows. This article attempts to lead a new user through the necessary steps to get Mercurial working.

  1. Download Mercurial from the Windows binary download site. This is http://mercurial.berkwood.com/ at the time of writing.
  2. Run the installer.
  3. Create a file called Mercurial.ini and put it in your sort-of home directory. I say sort-of because it's not necessarily the directory that would be set as $HOME. The directory you want to save the file in is normally called C:\Documents and Settings\John Smith\ (obviously replacing John Smith with your name)! Remember that Mercurial.ini on Windows replaces .hgrc on Unix/Linux systems so you do not need a .hgrc file.
    You can use this .ini file to store settings. Mine just has
    [ui]
    username = Tom Oakley <myemail@mycompany.com>

  4. Set up a given program to help merging conflicts. You do this by putting a file called hgmerge.cmd in your Mercurial install directory, which is probably C:\Program Files\Mercurial.
    I already had TortoiseSVN installed so I set my merge program to be TortoiseMerge. The page http://www.selenic.com/mercurial/wiki/index.cgi/MergeProgram explains what to put in that script for various merge programs.
  5. Then you can really get into the Quick start tutorial.

I hope this helps!

Please comment on this page:


Message:

Privacy policy