mercurial/util.py
changeset 5644 e2e8e977a6cb
parent 5525 dcbda0c4c3eb
child 5646 c722bd73c948
equal deleted inserted replaced
5641:4d6b630d3939 5644:e2e8e977a6cb
   958         pf = output_line[14:]
   958         pf = output_line[14:]
   959         if pf[0] == '`':
   959         if pf[0] == '`':
   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
   966 
   972 
   967     def set_exec(f, mode):
   973     def set_exec(f, mode):
  1099                 pf = pf[1:-1] # Remove the quotes
  1105                 pf = pf[1:-1] # Remove the quotes
  1100         else:
  1106         else:
  1101            if pf.startswith("'") and pf.endswith("'") and " " in pf:
  1107            if pf.startswith("'") and pf.endswith("'") and " " in pf:
  1102                 pf = pf[1:-1] # Remove the quotes
  1108                 pf = pf[1:-1] # Remove the quotes
  1103         return pf
  1109         return pf
       
  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
  1104 
  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)
  1108 
  1119