hg: added --ssh to specify which SSH binary to use

Perez-Gonzalez, Inaky inaky.perez-gonzalez at intel.com
Thu Aug 18 16:14:02 CDT 2005


>From: mercurial-bounces at selenic.com
[mailto:mercurial-bounces at selenic.com] On Behalf Of Thomas Arendsen Hein
>
>* Perez-Gonzalez, Inaky <inaky.perez-gonzalez at intel.com> [20050818
22:27]:
>> hg: added --ssh to specify which SSH binary to use
>>
>> My first inroad in python code, so it is kind of dirty for sure. I
use
>> a global (commands.ssh_command) to store the name of the SSH binary.
I
>> am guessing I should also add some support for it in .hgrc, but I
have
>> seriously stretched my python knowledge.
>
>I think this doesn't need a short option, --ssh (or --rsh to use a
>more generic name and to be consistent with rsync) is enough.

>Usually one will only need a .hgrc option, because either you have
>ssh in a strange path, or you don't have it. Special options to ssh
>can be given via the ~/.ssh/config file.

The main reason I need this for is because many times I have my repos
in remote machines and I push them from a cron job; to avoid having to
expose my private keys, I create a self-executing one with a dedicated
key (http://www.kitenet.net/~joey/sshcvs/sshanoncvs more info about it
in the parent http://www.kitenet.net/~joey/sshcvs/) and then add
a in dsthost:authorized_keys:

no-port-forwarding,no-X11-forwarding,no-agent-forwarding,\
command="hg -R $REPODIR --serve stdio" ssh-dss IJEIJIEJKEYDATA...

Now, for me, human, manually doing it, I use SSH because I have my
keyring active; but when cron runs it, I want to tell it to use
that file with the dedicated key with no password that only allows 
pushing to that repo.

If it where only in hgrc, then cron or me would have to modify it.
By having it as a cmdline option (and optionally also in hgrc), it
becomes more flexible. Cron puts the -R, I get to type less :]

>But for push/pull/incoming/outgoing it might be good to be able to
>specify the remote hg command, as it might not be installed system
>wide and the user doesn't want to modify the .bashrc.
>Maybe using --hg-path?

That makes sense to me.

>Look at --verbose, ui.verbose and friends.

Errr, been trying for a while, I don't even know where to hook it.
When is it done reading both ~/.hgrc and REPO/hgrc? It is just after
that that I would have to stack'em up and decide what to use:

1 command line
2 environment? HG_RSH
3 REPO/hgrc
4 ~/.hgrc
5 default ('ssh')

Ideally I could also define a function that gives that, but it is
kind of silly if it is so static.

So, where do I hook to set ssh_command?
 

-- Inaky



More information about the Mercurial mailing list