Installing Mercurial from Backports on Debian Lenny

July 4, 2010

The default version of Mercurial in Debian Lenny is 1.0.1 - not exactly the bleeding edge. To load Mercurial from backports (1.3.1) following the instructions below.

Add the backports repository to your /etc/apt/sources.list:

# backports
deb <a href="http://www.backports.org/debian">http://www.backports.org/debian</a> lenny-backports main contrib non-free

Next, create the file /etc/apt/preferences, with the following contents. This will allow mercurial to be installed from the backports repository.

Package: mercurial
Pin: release a=lenny-backports
Pin-Priority: 999

Package: mercurial-common
Pin: release a=lenny-backports
Pin-Priority: 999

Finally, run apt-get update then apt-get install mercurial.