A DVCS written in Python
Mercurial 1.0 was released on 19 March 2008 by Matt Mackall. The project had started in April 2005 — the same week as Git’s first commit — as the community’s answer to BitKeeper’s abandonment for Linux kernel development. While Linus Torvalds took the path of a ground-up C rewrite, Matt Mackall chose Python as main language (with performance-critical modules in C), prioritising readability and extensibility over raw speed.
Version 1.0 formalises three years of stabilisation: data architecture, user commands, network protocol. It is distributed under GPLv2 (later GPLv2+ with 2.x).
Data architecture
Like Git, Mercurial is a DVCS — each clone contains the full repository history. Unlike Git, Mercurial’s data model is more conventional:
- History as a DAG of changesets, each identified by a SHA-1 hash
- Revlog as storage format — one append-only file per tracked file + one for the manifest, with incremental deltas
- Manifest per changeset — filesystem snapshot at that moment
- Named branches as changeset attribute (not movable pointers like Git)
- Explicit rename and copy tracking, not inferred by similarity
The result is a system in which common operations are predictable and documentable. A CVS or Subversion user finds in Mercurial a mental model more accessible than Git’s, with equal distributed power.
Commands and usability
The main commands — hg clone, hg pull, hg push, hg commit, hg update, hg log, hg diff, hg status, hg merge, hg branch, hg tag — have orthogonal and consistent names and semantics. Each command does one thing, without modes (unlike Git, where many commands have flags that radically change behaviour).
Extensions (official subsystem, plus third parties) let Mercurial be extended with optional features — mq (Mercurial Queues for patch management), rebase, churn, color, progress, transplant, hgk.
The integrated web interface hgweb provides a repository browser without external dependencies.
Network protocols
Mercurial supports transport via:
- HTTP(S) — through
hg serveorhgwebon Apache/Nginx - SSH
- Local filesystem (bundle files)
The protocol is efficient in sending incremental changesets: initial clones are comparable to Git, subsequent pulls are optimised.
Institutional adoption
As of 2008 Mercurial has gathered significant adoptions:
- Mozilla migrates Firefox and Thunderbird from CVS to Mercurial in 2007-2008
- OpenJDK (Sun Microsystems) — migration from 2007
- Xen hypervisor
- Xen Project repository
- NetBeans (Sun)
- Many OCaml, Haskell, scientific projects
The choice is often motivated by a lower learning curve vs. Git, the fact that everyone can read the code (Python) and contribute to core, and the API stability of extensions.
Bitbucket
In 2008 Bitbucket is launched as hosting dedicated to Mercurial — the functional equivalent of GitHub for the Hg world. GitHub/Bitbucket competition is starting to mirror Git/Mercurial competition.
Graphical tools
The Mercurial ecosystem in 2008-2009 includes:
- TortoiseHg — Windows Explorer integration (analogue to TortoiseSVN for SVN)
- hggit — extension for Git repository interoperability
- Kiln (Fog Creek) — enterprise Mercurial hosting
- MacHg, SourceTree — graphical clients
Comparison with Git
Mercurial and Git share the DVCS model and have parallel trajectories. Mercurial’s differentiation points:
- Simpler data model — lower learning curve
- Python extensibility — custom enterprise plugins simpler
- Comparable performance on medium-sized repositories
- Immutable history by default — rewriting already-pushed changesets is harder (except via mq or hg strip), appreciated where audit trail is critical
In the Italian context
As of 2008 Italian Mercurial adoption is modest, with usage clusters:
- University Python research groups — Mercurial being Python makes it attractive
- Some software houses specialised in Java/Python preferring Hg’s usability to Git’s
- International projects (Mozilla, OpenJDK, Xen) with Italian contribution
Historical role
Mercurial 1.0 shows that a quality DVCS can be built with a high-level interpreted language without substantial performance compromises. This technical demonstration — that “Python is fast enough” for a demanding application like version control — contributes to consolidating Python as language suited to serious development tooling, not just scripting or scientific research.
References: Mercurial 1.0 (19 March 2008). Matt Mackall. GPLv2 licence. Mozilla, OpenJDK, Xen as early adopters. Bitbucket (2008). TortoiseHg.