Braindump

Mercurial Notes

Notes on Mercurial

Mercurial is a distributed version control system. It was initiated by Matt Mackall.

Repository Hosting

  • Bit Bucket
    • Free hosting of 1 private and unlimited public repositories
    • Support accessing the website with OpenID
    • SSH push/pull with public key authentication

Settings File

The hgrc file contains various settings. There is stuff that I just can't seem to remember...

  • The per-user hgrc file is located at $HOME/.hgrc on Unix systems and at %USERPROFILE%\.hgrc or %USERPROFILE%\Mercurial.ini on Windows systems.
  • The per-repository hgrc file is located at /path/to/repo/.hg/hgrc. This file is not version controlled. I.e. it will not be cloned, pushed or pulled.

My per-user hgrc file usually looks like this (well, with my real contact data of course):

[ui]
ignore = ~/.hgignore
username = John Doe <jdoe@example.org>

[diff]
git = True

[extensions]
hgext.mq =
hgext.convert =

Ignoring files

The hgignore file contains a list of file name patterns that you do not want to be version controlled, e.g. backup files of your editor or compiler output. This file must be located in the project root directory, i.e. /path/to/repo/.hgignore. Additionally, sticking to the .hgrc file above, per-user ignore patterns (used across all projects) could go into $HOME/.hgignore.

The following is a copy & paste template for a new .hgignore file:

syntax: glob

# ignore temporary and/or backup files of various ediors
*~
*.bak
*.swp

# ignore IDE specific stuff (Netbeans)
nbproject

# ignore IDE specific stuff (Eclipse)
.classpath
.project
.settings

Starting from here, add your language and project specific details. E.g. for a C project you might want to ignore object files *.o, while for a Java project you'd want to ignore *.class files instead and for Python you'd rather ignore *.pyc and so on and so forth...