|Initial release||19 April 2005|
|Stable release||2.8.1 / 1 December 2013|
|Written in||Python and C|
|Operating system||Unix-like, Windows, Mac OS X|
|License||GNU GPL v2+|
Mercurial is a cross-platform, distributed revision control tool for software developers. It is mainly implemented using the Python programming language, but includes a binary diff implementation written in C. It is supported on Windows and Unix-like systems, such as FreeBSD, Mac OS X and Linux. Mercurial is primarily a command line program but graphical user interface extensions are available. All of Mercurial's operations are invoked as arguments to its driver program hg, a reference to the chemical symbol of the element mercury.
Mercurial's major design goals include high performance and scalability, decentralized, fully distributed collaborative development, robust handling of both plain text and binary files, and advanced branching and merging capabilities, while remaining conceptually simple. It includes an integrated web interface. Mercurial has also taken steps to ease the transition for SVN users.
Mercurial uses SHA-1 hashes to identify revisions. For repository access via a network, Mercurial uses an HTTP-based protocol that seeks to reduce round-trip requests, new connections and data transferred. Mercurial can also work over ssh where the protocol is very similar to the HTTP-based protocol. By default it uses a 3-way merge before calling external merge tools.
BitKeeper had been used for the version control requirements of the Linux kernel project. Mackall decided to write a distributed version control system as a replacement for use with the Linux kernel. This project started a few days after another project called Git, initiated by Linus Torvalds with similar aims.
In an answer on the Mercurial mailing list, Matt Mackall explained how the name "Mercurial" was chosen:
Shortly before the first release, I read an article about the ongoing Bitkeeper debacle that described Larry McVoy as mercurial (in the sense of 'fickle'). Given the multiple meanings, the convenient abbreviation, and the good fit with my pre-existing naming scheme (see my email address), it clicked instantly. Mercurial is thus named in Larry's honor. I do not know if the same is true of Git.
Figure 1 shows some of the most important operations in Mercurial and their relations to Mercurial's concepts.
- GUI interfaces for Mercurial include:
- Hgk (tcl/tk)
- This is implemented as a Mercurial extension, and is part of the official version. This viewer displays the directed acyclic graph of the changesets of a Mercurial repository. This viewer can be invoked via the command
hg view, if the extension is enabled. hgk was originally based on a similar tool for Git called gitk. There is an hgk replacement named hgview that is written in pure Python and provides both gtk and qt interfaces.
- TortoiseHg is a shell extension and a series of applications for the Mercurial distributed revision control system. It is available for Windows Explorer and GNOME Nautilus.
- A Mac OS X GUI in Objective-C 2.0, runs on Mac OS X 10.5 and later.
- A Mac OS X GUI "not intended to completely replace command line use of Mercurial, only to ease the most common Mercurial operations," for Mac OS X 10.4 or later.
- MacHg is a free and fast multithreaded front end for Mac OS X 10.6 and later.
- A freeware Mac OS X and Windows GUI client that works with both Mercurial and Git.
- A freeware TUI client for Linux and Windows (using cygwin).
- Related tools for merging include (h)gct (Qt) and Meld.
- The convert extension allows import from CVS, Darcs, Git, GNU Arch, Monotone, Perforce, Bazaar and Subversion repositories.
- Microsoft Visual Studio supports Mercurial with the VisualHG and HgSccPackage plugins.
- NetBeans supports Mercurial from Version 6.
- Eclipse supports Mercurial with the MercurialEclipse plugin.
Source code hosting
The following websites provide free source code hosting for Mercurial repositories:
- Google Code
- Codebase by aTech Media
- JavaForge by Intland Software (with pull requests to control source code contribution)
- Project Kenai by Oracle Corporation
- GNU Savannah
- Alioth by Debian
- Kiln by Fog Creek Software
- Others listed in the Mercurial wiki
Projects using Mercurial
Some projects using the Mercurial distributed RCS:
- Adblock Plus
- Coveo
- Dovecot IMAP server
- GNU Health
- GNU Multi-Precision Library
- GNU Octave
- Go programming language
- Lugaru HD
- LuxRender 3D Render Engine
- MoinMoin wiki software
- Python (programming language)
- Symbian OS
- Nokia Maps
- Distributed revision control
- List of revision control software
- Comparison of revision control software
- Mackall, Matt (2005-04-20). "Mercurial v0.1 - a minimal scalable distributed SCM". Linux kernel mailing list. http://www.ussg.iu.edu/hypermail/linux/kernel/0504.2/0670.html.
- Mercurial 2.8.1 - 
- Matt Mackall, Towards a Better SCM: Revlog and Mercurial, Ottawa Linux Symposium Proceedings, 2006.
- Mackall, Matt (2005-04-29). "Re: Mercurial 0.4b vs git patchbomb benchmark". Linux kernel mailing list. http://lkml.indiana.edu/hypermail/linux/kernel/0504.3/1404.html.
- Mackall, Matt (2012-02-15). "Why did Matt choose the name Mercurial?". Mercurial mailing list. http://groups.google.com/group/mercurial_general/browse_thread/thread/737fd2337a7b4b59/90d9fc0f98381fe6?show_docid=9776a64773dedbde. Retrieved 8 March 2012.
- "CodePlex Weblog: CodePlex now supporting native Mercurial". 2010-01-22.
- "Google Code Blog: Mercurial Now Available to All Open Source Projects". 2009-05-28.
- "Codebase - Git, Mercurial & Subversion hosting". 2013-03-04.
- Some projects that use Mercurial
- "Source code repositories migrated from Subversion to Mercurial". 2010-02-27.
- Timo Sirainen (2007-05-19). "CVS to Mercurial switch". Dovecot-news mailing list. http://www.dovecot.org/list/dovecot-news/2007-May/000044.html.
- "Mercurial Work Flow". 2011-03-13.
- Ryan C. Gordon (2010-05-11). "Lugaru goes open source!".
- J. Paul Reed (2007-04-12). "Version Control System Shootout Redux Redux".
- "Switch to hg.netbeans.org completed". January 2008.
- "Mercurial « OGRE – Open Source 3D Graphics Engine". 2010-04-04.
- James Gosling (October 2006). James Gosling on Open Sourcing Sun's Java Platform Implementations, Part 1. Interview with Robert Eckstein. http://java.sun.com/developer/technicalArticles/Interviews/gosling_os1_qa.html.
- "OpenIndiana Source Repositories". 2011-03-13.
- "RawTherapee". 2010-01-04.
- "Mercurial Repositories". Retrieved 13 April 2011.
- David Wood (2009-04-06). "We decided in the end to use Mercurial rather than Git.". Retrieved 2009-05-07.
- "Distributed VCS: On git and mercurial, a transition from SVN".
- Official website
- Mercurial: The Definitive Guide a book by Bryan O'Sullivan published in 2009 by O'Reilly and freely available online
- Mercurial: an alternative to git from LWN.net
- An example-based Mercurial tutorial covering both basic and advanced use
- Google TechTalk on Mercurial
- Subversion or CVS, Bazaar or Mercurial? Four open source version control systems compared
- Joel Spolsky's Mercurial tutorial
- FLOSS Podcast featuring project lead Matt Mackall