Introduction to Mercurial

Mercurial is a distributed source control management tool similar to Git and Bazaar. Mercurial is written in Python and is used by projects such as Mozilla and Vim.

This package is known to build and work properly using an LFS-9.0 platform.

Package Information

  • Download (HTTP):

  • Download MD5 sum: 7b1902492cee88acfc3b62caae70f636

  • Download size: 6.9 MB

  • Estimated disk space required: 74 MB (with docs, add 571 MB for tests)

  • Estimated build time: 0.5 SBU (with docs, add 10 SBU for tests using -j4)

Mercurial Dependencies




docutils-0.15 (required to build the documentation), git-2.23.0, GnuPG-2.2.17 (gpg2 with Python bindings), OpenSSH-8.0p1 (runtime, to access ssh://... repositories), Pygments-2.4.2, Subversion-1.12.2 (with Python bindings), Bazaar, CVS, pyflakes, and pyOpenSSL

User Notes:

Installation of Mercurial

Build Mercurial by issuing the following command:

make build

To build the documentation (requires docutils-0.15), issue:

sed -i '/runrst/s/N)/N)3/' doc/Makefile &&
2to3-3.7 -w doc/            &&
make doc

To run the test suite, issue:

rm -rf tests/tmp &&
TESTFLAGS="-j<N> --tmpdir tmp --blacklist blacklists/fsmonitor --blacklist blacklists/linux-vfat" make check

where <N> is an integer between one and the number of ( processor X threads ), inclusive. In order to investigate any apparently failing tests, you may use the script. To see the almost forty switches, some of them very useful, issue tests/ --help. Running the following commands, you will execute only the tests that failed before:

pushd tests  &&
  rm -rf tmp &&
  ./ --tmpdir tmp test-gpg.t

Normally, the previous failures will be confirmed. However, if you add the switch "--debug" before "--tmpdir", and run again, some failures are gone, which seems to be a problem with the test suite. If this happens, normally, from now on, there will be no more such failures whether you use the debug switch or not. Three tests, test-alias.t, test-install.t, and test-bundle2-exchange.t (intermittently), are known to fail.

An interesting switch is "--time", which will generate at the end of the test suite execution, a table with all executed tests and respective start, end, user, system and real times. Note that the switches may be used with make check by including them in the TESTFLAGS environment variable.

Install Mercurial by running the following command (as root):

make PREFIX=/usr install-bin

If you built the documentation, install it by running the following command (as root):

make PREFIX=/usr install-doc

After installation, two very quick and simple tests should run correctly. The first one needs some configuration:

cat >> ~/.hgrc << "EOF"
username = <user_name> <user@mail>

where you must replace <user_name> and <your@mail> (mail is optional and can be omitted). With the user identity defined, run hg debuginstall and several lines will be displayed, the last one reading "no problems detected". Another quick and simple test is just hg, which should output basic commands that can be used with hg.

Command Explanations

sed -i '/runrst/s/N)/N)3/' doc/Makefile: forces the use of Python 3 for commands using docutils, allowing to use the docutils Python 3 module.

2to3-3.7 -w doc/ Since Python 3 is used with docutils, one file needs to be converted in order to be compatible.

Configuring Mercurial

Config Files

/etc/mercurial/hgrc and ~/.hgrc

The great majority of extensions are disabled by default. Run hg help extensions if you need to enable any, e.g. when investigating test failures. You will obtain the lists of enabled and disabled extensions, and more information, such as how to enable or disable them using configuration files.

If you have installed make-ca-1.4 and want Mercurial to use them, as the root user, issue:

install -v -d -m755 /etc/mercurial &&
cat > /etc/mercurial/hgrc << "EOF"
cacerts = /etc/pki/tls/certs/ca-bundle.crt


Installed Programs: hg
Installed Libraries: several internal modules under /usr/lib/python2.7/site-packages/mercurial
Installed Directories: /etc/mercurial and /usr/lib/python2.7/site-packages/{hgdemandimport,hgext,hgext3rd,mercurial}

Short Descriptions


is the mercurial version control system.

Last updated on 2019-08-21 15:35:43 -0700