Question

There are two project in which I collaborate, they live in different servers, A and B. While A has the hg program in /opt/mercurial/bin/hg, B has it in /usr/local/bin/hg.

When I want to pull/push changes to either remote, I have to manually modify .hgrcfile in order for the option remotecmdto point to the right location of hg.

I would like to know if it is possible to setup different remotecmdpaths for different remotes so that I don't have to manually change the path of the hgprogram everytime I need to do some remote operation.

I saw this question: Setup platform-dependent hgrc but it seemed to me that there should be a more native (something like a built-in setting) way to do this. So far I haven't been able to find it, so any help will be welcome :)

Thanks!

Was it helpful?

Solution

Ideally you just get the hg binary into your $PATH on both servers and you don't have to think about it anymore. That can be done in the system's /etc/profile or in your .ssh/enviironment on that remote server. Most people never even need to think about remotecmd.

If they're separate projects (or even separate clones locally of the same project) you can set the remotecmd in the .hg/hgrc file within each repository -- settings don't just have to be in your ~/hgrc file.

Also be aware that --remotecmd is available as a command line option for push and pull, so you could use that and even combine it with something like:

[alias]
pusha = push --remotecmd /opt/mercurial/bin/hg

and then you can just do hg pusha

Really though, just try to get hg into your path like everyone else does.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top