Open main menu

Mercurial is a distributed revision-control tool for software developers. It is supported on Microsoft Windows and Unix-like systems, such as FreeBSD, macOS and Linux.

Mercurial no border logo.svg
Developer(s)Matt Mackall
Initial release19 April 2005; 14 years ago (2005-04-19)[1]
Stable release
5.1[2] / 1 August 2019; 20 days ago (2019-08-01)
Written inPython and C
Operating systemUnix-like, Windows, macOS
TypeVersion control
LicenseGNU GPL v2+

Mercurial's major design goals include high performance and scalability, decentralization, fully distributed collaborative development, robust handling of both plain text and binary files, and advanced branching and merging capabilities, while remaining conceptually simple.[3] It includes an integrated web-interface. Mercurial has also taken steps to ease the transition for users of other version control systems, particularly Subversion. Mercurial is primarily a command-line driven program, but graphical user interface extensions are available, e.g. TortoiseHg, and several IDEs offer support for version control with Mercurial. All of Mercurial's operations are invoked as arguments to its driver program hg (a reference to Hg - the chemical symbol of the element mercury).

Matt Mackall originated Mercurial and served as its lead developer until late 2016. Mercurial is released as free software under the terms of the GNU GPL v2 (or any later version[4]). It is mainly implemented using the Python programming language, but includes a binary diff implementation written in C.



Mackall first announced Mercurial on 19 April 2005.[1] The impetus for this was the announcement earlier that month by Bitmover that they were withdrawing the free version of BitKeeper.

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 the now well-known Git project was initiated by Linus Torvalds with similar aims.[5]

The Linux kernel project decided to use Git rather than Mercurial, but Mercurial is now used by many other projects (see below). "Git vs. Mercurial" has become one of the holy wars of hacker culture.[6]

In an answer on the Mercurial mailing list, Matt Mackall explained how the name "Mercurial" was chosen:

In 2013, Facebook adopted Mercurial and began work on scaling it to handle their large, unified code repository.[9]


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.


Figure 1 shows some of the most important operations in Mercurial and their relations to Mercurial's concepts.

Figure 1: Some important operations of Mercurial and their relations.


Although Mercurial was not selected to manage the Linux kernel sources, it has been adopted by several organizations, including Facebook,[10] the W3C, and Mozilla. Facebook is using the Rust programming language to write Mononoke[11][12], a Mercurial server specifically designed to support large multi-project repositories.

Mercurial servers and repository managementEdit

Source code hostingEdit

The following websites provide free source code hosting for Mercurial repositories:

Open source projects using MercurialEdit

Some projects using the Mercurial distributed RCS:[20]

See alsoEdit


  1. ^ a b Mackall, Matt (20 April 2005). "Mercurial v0.1 – a minimal scalable distributed SCM". Linux kernel (Mailing list).
  2. ^ "NewsItems". Mercurial Wiki. 1 August 2019. Retrieved 1 August 2019.
  3. ^ Mackall, Matt. "Towards a Better SCM: Revlog and Mercurial" (PDF). Mercurial. Archived (PDF) from the original on 26 May 2019. Retrieved 26 May 2019.
  4. ^ "Relicensing", Mercurial (wiki),
  5. ^ Mackall, Matt (29 April 2005). "Re: Mercurial 0.4b vs git patchbomb benchmark". Linux kernel (Mailing list). Archived from the original on 9 July 2012.
  6. ^ "Managing source code with Mercurial". Mercurial and Git fans are also happy to discuss the learning curve, merits, and usability of each VCS system's command set. Space prevents that discussion here, but a web search on that topic will provide lots of interesting reading material.
  7. ^ Mackall, Matt (15 February 2012). "Why did Matt choose the name Mercurial?". Mercurial (Mailing list). Retrieved 7 June 2016.
  8. ^ Torvalds has said: "I'm an egotistical bastard, so I name all my projects after myself. First Linux, now git."
  9. ^ Goode, Durham; Agarwal, Siddharth. "Scaling Mercurial at Facebook". Facebook Code. Facebook. Retrieved 13 October 2015.
  10. ^ "Scaling Mercurial at Facebook". 7 January 2014.
  11. ^ "A Mercurial source control server, specifically designed to support large monorepos.: facebookexperimental/mononoke". 31 January 2019 – via GitHub.
  12. ^ "Google Groups".
  13. ^ "Sunsetting Mercurial support in Bitbucket".
  14. ^ "Git, Mercurial & Subversion hosting". Features. Codebase HQ. 4 March 2013.
  15. ^ "Welcome [Puszcza]".
  16. ^ "Let's start OSS development with Mercurial (Hg) - OSDN".
  17. ^ "Try Helix TeamHub Free | Perforce".
  18. ^ "TuxFamily: Free hosting for free people".
  19. ^ "Hosting", Mercurial (wiki),
  20. ^ "Some projects that use Mercurial", Mercurial (wiki),
  21. ^ "Source code repositories migrated from Subversion to Mercurial". Coin3D (news). 27 February 2010.
  22. ^ "Mercurial Work Flow" (wiki). Illumos. 13 March 2011.
  23. ^ Reed, J Paul (12 April 2007). "Version Control System Shootout Redux Redux".
  24. ^ James Gosling (October 2006). "Open Sourcing Sun's Java Platform Implementations, Part 1" (Interview). Interviewed by Robert Eckstein. Sun. Archived from the original on 1 March 2009.CS1 maint: Unfit url (link)

External linksEdit