Kirinya Kirinya - 20 days ago 5
Linux Question

How to rewrite Mercurial pull URL to not point to HOME

I have a Linux server that will be hosting multiple mercurial repositories over SSH.
All the repositories lie in the folder HG_HOME/repos, where HG_HOME ist the home directory of the hg user.

The following command for pull works:

ssh://hg@my.server/repos/REPO_NAME


For ease of use, I would however like to use:

ssh://hg@my.server/REPO_NAME


Is this possible? If yes, where do I configure it?

The version used is 4.0

Answer

The following is not an exact solution, but the schemes extension (which comes with Mercurial) may be a usable alternative. It allows you to create your own URL schemes, for example:

[extensions]
schemes=
[schemes]
my = ssh://hg@my.server/repos/

This allows you to then use the my URL scheme, e.g.:

hg pull my://REPO_NAME