##// END OF EJS Templates
win32: fix ssh://host:port when using Plink...
Steve Borho -
r5644:e2e8e977 default
parent child Browse files
Show More
@@ -24,12 +24,11 b' class sshrepository(remoterepository):'
24 self.port = m.group(5)
24 self.port = m.group(5)
25 self.path = m.group(7) or "."
25 self.path = m.group(7) or "."
26
26
27 args = self.user and ("%s@%s" % (self.user, self.host)) or self.host
28 args = self.port and ("%s -p %s") % (args, self.port) or args
29
30 sshcmd = self.ui.config("ui", "ssh", "ssh")
27 sshcmd = self.ui.config("ui", "ssh", "ssh")
31 remotecmd = self.ui.config("ui", "remotecmd", "hg")
28 remotecmd = self.ui.config("ui", "remotecmd", "hg")
32
29
30 args = util.sshargs(sshcmd, self.host, self.user, self.port)
31
33 if create:
32 if create:
34 cmd = '%s %s "%s init %s"'
33 cmd = '%s %s "%s init %s"'
35 cmd = cmd % (sshcmd, args, remotecmd, self.path)
34 cmd = cmd % (sshcmd, args, remotecmd, self.path)
@@ -960,6 +960,12 b" if os.name == 'nt':"
960 pf = pf[1:-1] # Remove the quotes
960 pf = pf[1:-1] # Remove the quotes
961 return pf
961 return pf
962
962
963 def sshargs(sshcmd, host, user, port):
964 '''Build argument list for ssh or Plink'''
965 pflag = 'plink' in sshcmd.lower() and '-P' or '-p'
966 args = user and ("%s@%s" % (user, host)) or host
967 return port and ("%s %s %s") % (args, pflag, port) or args
968
963 def testpid(pid):
969 def testpid(pid):
964 '''return False if pid dead, True if running or not known'''
970 '''return False if pid dead, True if running or not known'''
965 return True
971 return True
@@ -1102,6 +1108,11 b' else:'
1102 pf = pf[1:-1] # Remove the quotes
1108 pf = pf[1:-1] # Remove the quotes
1103 return pf
1109 return pf
1104
1110
1111 def sshargs(sshcmd, host, user, port):
1112 '''Build argument list for ssh'''
1113 args = user and ("%s@%s" % (user, host)) or host
1114 return port and ("%s -p %s") % (args, port) or args
1115
1105 def is_exec(f):
1116 def is_exec(f):
1106 """check whether a file is executable"""
1117 """check whether a file is executable"""
1107 return (os.lstat(f).st_mode & 0100 != 0)
1118 return (os.lstat(f).st_mode & 0100 != 0)
General Comments 0
You need to be logged in to leave comments. Login now