First, if you want to install extensions globally, your best choice may be to do this in the global hgrc
file rather than having users do it locally. If you enable an extension in /etc/mercurial/hgrc
, then it will be enabled for all users.
You can also enable them in <install-root>/etc/mercurial/hgrc
, where <install-root>
is the parent directory of the directory where the Mercurial executable is installed. E.g., if Mercurial is executed via /opt/local/bin/hg
, then <install-root>
is /opt/local
. However, this is more fragile, since (by design) symbolic links aren't followed. For example, if a user links Mercurial to their ~/bin/hg
, then ~/etc/mercurial/hgrc
would be consulted instead for them.
If you simply want to make extensions available to user, but not enable them by default, then they have to go in the Python site-packages directory, same as the normal extensions. This would be your global Python installation, assuming Mercurial uses that; however, you can use virtualenv
to have a Mercurial-specific Python installation, where you can install extensions and other stuff without polluting the main Python installation. The normal setup.py
script of an extension should properly deal with either case (e.g., the setup.py
of the evolve extension will put evolve.py
in the site-packages/hgext
directory).