Install and setup Mercurial#
Mercurial needs to be installed AND setup. After installation, do not forget to follow the steps presented in the session Setup Mercurial.
Install Mercurial#
With TortoiseHG (simple for Windows)#
Download the installer from https://tortoisehg.bitbucket.io/.
With pipx (recommended on Linux)#
We present pipx and how to install it here.
pipx install mercurial
pipx inject mercurial hg-git hg-evolve hg-fluiddyn
# potentially useful to fix ssl issues (macOS)
pipx inject mercurial certifi
pipx install hg-setup
With conda (cross-platform, recommended for conda users on Windows, Linux and macOS)#
On Windows, macOS and Linux, one can use conda
(installed with
miniforge) to install Mercurial with
few extensions (hg-evolve and
hg-git). On Windows, these commands have to be run in the
Anaconda Prompt. First, we need to install
conda-app in the base conda environment:
conda activate base
pip install conda-app
Then, with the conda-forge channel added (conda config --add channels conda-forge
), one
just needs to run:
conda-app install mercurial
Open a new terminal and the Mercurial command hg
should be available.
Note
If you don’t use TortoiseHG, you should really install the visual diff and merge tool Meld!
Setup Mercurial#
You need a file ~/.hgrc
containing something like
this file.
A decent Mercurial configuration file can be created with hg config --edit
. Alternatively (recommended for Fluiddyn development), one can use hg-setup
to create the user configuration file and initialize shell completion:
hg-setup init
Warning
You should now have a file .hgrc
(or mercurial.ini
on Windows) in your home directory.
The line starting with hggit is optional and enables the extension hg-git. This extension is useful to work on projects using Git, for example hosted on Github and Gitlab.
The extensions churn, shelve, rebase, absorb, evolve and topic are very useful for more advanced users. Note that evolve and topic comes from the package hg-evolve.
Warning
We wrote a specific Mercurial extension for FluidDyn development called hg-fluiddyn. All FluidDyn contributors / developers / maintainers should install and activate it!
With Mercurial installed with conda-app
(as explained above), just run:
conda run -n _env_mercurial pip install hg-fluiddyn
and activate the extension with the line hgfluiddyn =
in the file ~/.hgrc
.
If Mercurial has been installed with pipx, you can run:
pipx inject mercurial hg-fluiddyn
Warning
For development of FluidDyn packages, the evolve and topic extensions have to be installed and activated! If they are not activated, the hg-fluiddyn extension will warn you!
Check your install#
You can check that Mercurial is correctly setup with
hg version -v
hg debuginstall
When everything is fine, you should be able to clone Git repos with something like:
hg clone https://gricad-gitlab.univ-grenoble-alpes.fr/legi/soft/trokata/softsync-python-debian11.git
or, alternatively and better, but you need to setup a SSH key on https://gricad-gitlab.univ-grenoble-alpes.fr/-/user_settings/ssh_keys (take time to do this since it is really useful!).
hg clone git@gricad-gitlab.univ-grenoble-alpes.fr:legi/soft/trokata/softsync-python-debian11.git