--- a/mercurial/util.py Mon Dec 10 22:41:18 2007 +0100
+++ b/mercurial/util.py Wed Dec 12 16:44:26 2007 -0600
@@ -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)