[PATCH] hg: added --ssh to specify which SSH binary to use

Matt Mackall mpm at selenic.com
Fri Aug 19 01:14:03 CDT 2005


On Thu, Aug 18, 2005 at 01:25:50PM -0700, Perez-Gonzalez, Inaky wrote:
> # HG changeset patch
> # User inaky.perez-gonzalez at intel.com
> # Node ID c724badabfa85d1775ebec99cab21abe46c3dd1d
> # Parent  1300271ba8dee502315bb8a3391e57f33c7f371f
> 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'd rather have this use -e than -S in keeping with rsync and friends.

Also, calling repo.ui.config("ui", "ssh", "ssh") to get the default is
probably a good idea.

> 
> diff -r 1300271ba8de -r c724badabfa8 mercurial/commands.py
> --- a/mercurial/commands.py	Thu Aug 18 02:52:27 2005
> +++ b/mercurial/commands.py	Thu Aug 18 20:22:38 2005
> @@ -10,6 +10,8 @@
>  demandload(globals(), "fancyopts ui hg util lock")
>  demandload(globals(), "fnmatch hgweb mdiff random signal time
> traceback")
>  demandload(globals(), "errno socket version struct atexit")
> +
> +ssh_command = "ssh"
>  
>  class UnknownCommand(Exception):
>      """Exception raised if command is not in the command table."""
> @@ -1403,6 +1405,7 @@
>                ('q', 'quiet', None, 'quiet mode'),
>                ('', 'profile', None, 'profile'),
>                ('R', 'repository', "", 'repository root directory'),
> +              ('S', 'ssh', "ssh", 'SSH command to use'),
>                ('', 'traceback', None, 'print traceback on exception'),
>                ('y', 'noninteractive', None, 'run non-interactively'),
>                ('', 'version', None, 'output version information and
> exit'),

These are the global options. You should make this specific to push.

>  def dispatch(args):
> +    global ssh_command

Eep!

> --- a/mercurial/hg.py	Thu Aug 18 02:52:27 2005
> +++ b/mercurial/hg.py	Thu Aug 18 20:22:38 2005
[...]
> +import commands

Eep! It'd be better to pass a set of options when creating a repo object.

-- 
Mathematics is the supreme nostalgia of our time.


More information about the Mercurial mailing list