Package: mercurial_extension_utils
This module contains group of reusable functions, which I found useful
while writing various Mercurial extensions.1For Mercurial users1.1Installing on Linux/Unix1.2Installing on Windows1.3Installing for development (or when everything else fails)2For Mercurial extensions developers2.1Available API2.2Tests3History4Repository, bug reports, enhancement suggestions5Additional notes1For Mercurial usersThis module is of no direct use for you. It is internally used by various
Mercurial extensions  (likeKeyring,Dynamic UsernameorPath 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).NoteThis document usesDynamic Usernamein examples, but the
same method should work for any other extension
which requiresmercurial_extension_utils.1.1Installing on Linux/UnixIn typical casemercurial_extension_utilsshould be installed
automatically, without requiring your attention, by commands likepip install mercurial_dynamic_username.If for some reason it did not work, just install from PyPi with:pip install --user mercurial_extension_utilsor system-wide with:sudo pip install mercurial_extension_utilsIf you don’t havepip, try:sudo easy_install mercurial_extension_utilsUpgrade to newer version using the same commands with--upgradeoption added, for example:pip install --user --upgrade mercurial_extension_utilsIf you miss bothpip, andeasy_install, follow
recipe fromInstalling for developmentsection.1.2Installing on WindowsWindows 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: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_usernameThis 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 yourMercurial.ini:[extensions]
mercurial_dynamic_username = C:/Python27/Lib/site-packages/mercurial_dynamic_username.pyNoteThis works becausemercurial_dynamic_username.pychecks formercurial_extension_utils.pysaved in the same directory (andpipinstalls both modules in the same place). You can get
the same effect by manually downloading all files into the same
directory (usingpipis more handy as it tracks dependencies
and supports upgrades).Upgrade withpipby adding--upgradeto it’s options.If you don’t have any Python, clone both the extension(s)
repository andmercurial_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 inMercurial.ini:[extensions]
mercurial_dynamic_username = C:/MercurialPlugins/mercurial-dynamic_username/mercurial_dynamic_username.pyNoteDirectory names matter. This works becausemercurial_dynamic_username.pychecks formercurial_extension_utils.pyin../mercurial_extension_utilsand../extension_utils(relative to it’s own location).To upgrade to new version, simply pull and update to newer tag.1.3Installing 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~/.hgrcsomething like:[extensions]
mercurial_dynamic_username = ~/sources/mercurial-dynamic_username/mercurial_dynamic_username.py2For Mercurial extensions developers2.1Available APIProvided 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.2TestsUnit-tests can be run by:python -m unittest discover tests/(against current version) or:tox(against various versions of mercurial and python).3HistorySeeHISTORY.rst4Repository, bug reports, enhancement suggestionsDevelopment is tracked on HeptaPod, seehttps://foss.heptapod.net/mercurial/mercurial-extension_utils/Use issue tracker there for bug reports and enhancement
suggestions.Thanks toOctobusandClever Cloudfor hosting this service.5Additional notesCheck alsoMercurial extensions I wrote.