Skip to main content

This module contains group of reusable functions, which I found useful while writing various Mercurial extensions.

1 For Mercurial users

This module is of no direct use for you. It is internally used by various Mercurial extensions (like Keyring, Dynamic Username or Path Pattern).

In most cases it should be installed automatically while you install one of those extensions. See below for installation instructions in more tricky cases (in particular, for information about installation on Windows).

1.1 Installing on Linux/Unix

In typical case mercurial_extension_utils should be installed automatically, without requiring your attention, by commands like pip install mercurial_dynamic_username.

If for some reason it did not work, just install from PyPi with:

pip install --user mercurial_extension_utils

or system-wide with:

sudo pip install mercurial_extension_utils

If you don’t have pip, try:

sudo easy_install mercurial_extension_utils

Upgrade to newer version using the same commands with --upgrade option added, for example:

pip install --user --upgrade mercurial_extension_utils

If you miss both pip, and easy_install, follow recipe from Installing for development section.

1.2 Installing on Windows

Windows Mercurial distributions (including most popular - and well deserving that - TortoiseHg) are not using system Python (in fact, one may use Mercurial without installing Python at all), and installing into bundled Python path is uneasy. To remedy that, extensions utilizing this module handle additional methods of locating it.

The following two methods of installation are available:

  1. If you have some Python installed, you may still install both this module, and extension using it, from PyPi. For example:

    pip install mercurial_extension_utils
    pip install mercurial_dynamic_username

    This will not (yet) make the module visible to your Mercurial, but you will get all the necessary files installed on your computer.

    Then activate the actual extension in charge by specifying it’s path, for example by writing in your Mercurial.ini:

    [extensions]
    mercurial_dynamic_username = C:/Python27/Lib/site-packages/mercurial_dynamic_username.py

    Upgrade with pip by adding --upgrade to it’s options.

  2. If you don’t have any Python, clone both the extension(s) repository and mercurial_extension_utils` and put them in the same place, for example:

    cd c:\MercurialPlugins
    hg clone https://foss.heptapod.net/mercurial/mercurial-extension_utils/
    hg clone https://foss.heptapod.net/mercurial/mercurial-dynamic_username/

    Update repositories to newest tagged versions (untagged versions may be unstable or not working).

    Activate the actual extension by specifying it’s path, for example by writing in Mercurial.ini:

    [extensions]
    mercurial_dynamic_username = C:/MercurialPlugins/mercurial-dynamic_username/mercurial_dynamic_username.py

    To upgrade to new version, simply pull and update to newer tag.

1.3 Installing for development (or when everything else fails)

On Windows use second variant from the previous chapter (clone and activate by path).

On Linux/Unix do the same. Clone all the necessary repositories, for example:

cd ~/sources/
hg clone https://foss.heptapod.net/mercurial/mercurial-extension_utils/
hg clone https://foss.heptapod.net/mercurial/mercurial-dynamic_username/

then either make it visible to Python by repeating in every repo:

pip install --user -e .

or activate the extension(s) by full path, by writing in ~/.hgrc something like:

[extensions]
mercurial_dynamic_username = ~/sources/mercurial-dynamic_username/mercurial_dynamic_username.py

2 For Mercurial extensions developers

2.1 Available API

Provided functions are mostly tiny utilities related to configuration processing or location matching. They either extend Mercurial APIs a bit (like function to iterate config items which match regexp), or support tasks which aren’t strictly Mercurial related, but happen repeatably during extension writing (like matching repository root against set of paths defined in the configuration).

Noticeable part of the library handles various incompatibilities between Mercurial versions.

See docstrings for details.

2.2 Tests

Unit-tests can be run by:

python -m unittest discover tests/

(against current version) or:

nox

(against various versions of mercurial and python).

3 History

See HISTORY.rst

4 Repository, bug reports, enhancement suggestions

Development is tracked on HeptaPod, see https://foss.heptapod.net/mercurial/mercurial-extension_utils/

Use issue tracker there for bug reports and enhancement suggestions.

Thanks to Octobus and Clever Cloud for hosting this service.

5 Additional notes

Check also Mercurial extensions I wrote.

Metadata

Release files for mercurial-extension-utils 1.5.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mercurial-extension-utils 1.5.3
File Size Uploaded
mercurial_extension_utils-1.5.3.tar.gz 28.6 kB Details

Release files / mercurial_extension_utils-1.5.3.tar.gz

Download URL mercurial_extension_utils-1.5.3.tar.gz
Size 28.6 kB
Tags Source
SHA-256 checksum
How to use checksums
7f53fe0ddcd8939708c8d60dfa3d07084d523abf0bd2660e5bcfcea4d1f512a3
BLAKE2b-256 checksum
How to use checksums
807fec3f3130dc090085262dfe9782cfbaede872ffb7feb376e3209ae84ca610
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

1.5.3 This release

1 release file

1.5.2

1 release file

1.5.1

1 release file

1.5.0

1 release file

1.4.0

1 release file

1.3.7

1 release file

1.3.6

1 release file

1.3.5

1 release file

1.3.4

1 release file

1.3.3

1 release file

1.3.2

1 release file

1.3.1

1 release file

1.3.0

1 release file

1.2.0

1 release file

1.1.2

1 release file

1.1.1

1 release file

1.1.0

1 release file

1.0.1

1 release file

1.0.0

1 release file

0.11.0

1 release file

0.10.0

1 release file

0.9.0

1 release file

0.8.1

1 release file

0.8.0

1 release file

0.7.0

1 release file

0.6.1

1 release file

0.6.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page