diff mercurial/util.py @ 5634:e2e8e977a6cb

win32: fix ssh://host:port when using Plink Moves ssh argument building to platform specific utils code. The win32 version looks for plink in ssh command string and uses '-P' in lieu of '-p' for specifying a port
author Steve Borho <steve@borho.org>
date Wed, 12 Dec 2007 16:44:26 -0600 (2007-12-12)
parents dcbda0c4c3eb
children c722bd73c948
line wrap: on
line diff
--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -960,6 +960,12 @@
             pf = pf[1:-1] # Remove the quotes
         return pf
 
+    def sshargs(sshcmd, host, user, port):
+        '''Build argument list for ssh or Plink'''
+        pflag = 'plink' in sshcmd.lower() and '-P' or '-p'
+        args = user and ("%s@%s" % (user, host)) or host
+        return port and ("%s %s %s") % (args, pflag, port) or args
+
     def testpid(pid):
         '''return False if pid dead, True if running or not known'''
         return True
@@ -1102,6 +1108,11 @@
                 pf = pf[1:-1] # Remove the quotes
         return pf
 
+    def sshargs(sshcmd, host, user, port):
+        '''Build argument list for ssh'''
+        args = user and ("%s@%s" % (user, host)) or host
+        return port and ("%s -p %s") % (args, port) or args
+
     def is_exec(f):
         """check whether a file is executable"""
         return (os.lstat(f).st_mode & 0100 != 0)