mercurial/windows.py
branchstable
changeset 47866 4162f6b40f2c
parent 47789 064cd182555f
child 48009 94d4a3f78e99
equal deleted inserted replaced
47865:95af358fcdfe 47866:4162f6b40f2c
   614     If gid is None, return the name of the current group."""
   614     If gid is None, return the name of the current group."""
   615     return None
   615     return None
   616 
   616 
   617 
   617 
   618 def readlink(pathname):
   618 def readlink(pathname):
   619     return pycompat.fsencode(os.readlink(pycompat.fsdecode(pathname)))
   619     path = pycompat.fsdecode(pathname)
       
   620     try:
       
   621         link = os.readlink(path)
       
   622     except ValueError as e:
       
   623         # On py2, os.readlink() raises an AttributeError since it is
       
   624         # unsupported.  On py3, reading a non-link raises a ValueError.  Simply
       
   625         # treat this as the error the locking code has been expecting up to now
       
   626         # until an effort can be made to enable symlink support on Windows.
       
   627         raise AttributeError(e)
       
   628     return pycompat.fsencode(link)
   620 
   629 
   621 
   630 
   622 def removedirs(name):
   631 def removedirs(name):
   623     """special version of os.removedirs that does not remove symlinked
   632     """special version of os.removedirs that does not remove symlinked
   624     directories or junction points if they actually contain files"""
   633     directories or junction points if they actually contain files"""