A Python library for interfacing with Mercurial's CommandServer

1. Getting the source

The package is available on PyPI or can be cloned from its primary repository at

2. License

Unlike Mercurial itself, which requires derived works be licensed with the GPLv2+, python-hglib is available under the less restrictive MIT license.

3. Installing

The package includes a standard distutils, so should install with:

$ python install

Gentoo-users can just emerge dev-python/hglib.

4. Basic usage

First create an hglib client object:

import hglib
client ="/path/to/repo")

Now you can perform Mercurial commands with a Python interface:

commit = client.tip()

For more examples, see the examples/ and tests/ dirs in the source.

5. Compatibility

It should be possible to use any version of python-hglib with all versions of Mercurial that support the command server protocol (Mercurial 1.9 or newer). Supported Python versions are 2.4-2.7 and Python 3.4.

6. Reporting bugs

This package is managed by the Mercurial project, so bugs can be reported to the main Mercurial BTS. Use the 'hglib' component of Mercurial in the component field.

7. Contributing code

Similarly, code contribution should (roughly) follow the guidelines from ContributingChanges. Please flag patches with 'hglib' (eg via patchbomb's --flag switch).

8. See also

PythonHglib (last edited 2017-11-23 05:22:38 by KevinBullock)