mercurial/posix.py
changeset 30642 e995f00a9e9a
parent 30641 16b5df5792a8
child 30697 13d94304c8da
equal deleted inserted replaced
30641:16b5df5792a8 30642:e995f00a9e9a
    78     return os.lstat(name).st_nlink
    78     return os.lstat(name).st_nlink
    79 
    79 
    80 def parsepatchoutput(output_line):
    80 def parsepatchoutput(output_line):
    81     """parses the output produced by patch and returns the filename"""
    81     """parses the output produced by patch and returns the filename"""
    82     pf = output_line[14:]
    82     pf = output_line[14:]
    83     if os.sys.platform == 'OpenVMS':
    83     if pycompat.sysplatform == 'OpenVMS':
    84         if pf[0] == '`':
    84         if pf[0] == '`':
    85             pf = pf[1:-1] # Remove the quotes
    85             pf = pf[1:-1] # Remove the quotes
    86     else:
    86     else:
    87         if pf.startswith("'") and pf.endswith("'") and " " in pf:
    87         if pf.startswith("'") and pf.endswith("'") and " " in pf:
    88             pf = pf[1:-1] # Remove the quotes
    88             pf = pf[1:-1] # Remove the quotes
   402     def checklink(path):
   402     def checklink(path):
   403         return False
   403         return False
   404 
   404 
   405 _needsshellquote = None
   405 _needsshellquote = None
   406 def shellquote(s):
   406 def shellquote(s):
   407     if os.sys.platform == 'OpenVMS':
   407     if pycompat.sysplatform == 'OpenVMS':
   408         return '"%s"' % s
   408         return '"%s"' % s
   409     global _needsshellquote
   409     global _needsshellquote
   410     if _needsshellquote is None:
   410     if _needsshellquote is None:
   411         _needsshellquote = re.compile(r'[^a-zA-Z0-9._/+-]').search
   411         _needsshellquote = re.compile(r'[^a-zA-Z0-9._/+-]').search
   412     if s and not _needsshellquote(s):
   412     if s and not _needsshellquote(s):
   421 def popen(command, mode='r'):
   421 def popen(command, mode='r'):
   422     return os.popen(command, mode)
   422     return os.popen(command, mode)
   423 
   423 
   424 def testpid(pid):
   424 def testpid(pid):
   425     '''return False if pid dead, True if running or not sure'''
   425     '''return False if pid dead, True if running or not sure'''
   426     if os.sys.platform == 'OpenVMS':
   426     if pycompat.sysplatform == 'OpenVMS':
   427         return True
   427         return True
   428     try:
   428     try:
   429         os.kill(pid, 0)
   429         os.kill(pid, 0)
   430         return True
   430         return True
   431     except OSError as inst:
   431     except OSError as inst: