mercurial/util.py
changeset 3998 315d47991fd4
parent 3997 3f0ba82c103f
child 3999 0b740dcf0cf1
equal deleted inserted replaced
3997:3f0ba82c103f 3998:315d47991fd4
   711     '''return an is_exec() function with default to fallback'''
   711     '''return an is_exec() function with default to fallback'''
   712     if checkexec(path):
   712     if checkexec(path):
   713         return lambda x: is_exec(os.path.join(path, x))
   713         return lambda x: is_exec(os.path.join(path, x))
   714     return fallback
   714     return fallback
   715 
   715 
       
   716 def checksymlink(path):
       
   717     """check whether the given path is on a symlink-capable filesystem"""
       
   718     # mktemp is not racy because symlink creation will fail if the
       
   719     # file already exists
       
   720     name = tempfile.mktemp(dir=path)
       
   721     try:
       
   722         os.symlink(".", name)
       
   723         os.unlink(name)
       
   724         return True
       
   725     except OSError:
       
   726         return False
       
   727 
   716 # Platform specific variants
   728 # Platform specific variants
   717 if os.name == 'nt':
   729 if os.name == 'nt':
   718     import msvcrt
   730     import msvcrt
   719     nulldev = 'NUL:'
   731     nulldev = 'NUL:'
   720 
   732