mercurial/windows.py
branchstable
changeset 47866 4162f6b40f2c
parent 47789 064cd182555f
child 48009 94d4a3f78e99
--- a/mercurial/windows.py	Wed Aug 18 21:59:55 2021 -0400
+++ b/mercurial/windows.py	Sun Aug 22 17:59:21 2021 -0400
@@ -616,7 +616,16 @@
 
 
 def readlink(pathname):
-    return pycompat.fsencode(os.readlink(pycompat.fsdecode(pathname)))
+    path = pycompat.fsdecode(pathname)
+    try:
+        link = os.readlink(path)
+    except ValueError as e:
+        # On py2, os.readlink() raises an AttributeError since it is
+        # unsupported.  On py3, reading a non-link raises a ValueError.  Simply
+        # treat this as the error the locking code has been expecting up to now
+        # until an effort can be made to enable symlink support on Windows.
+        raise AttributeError(e)
+    return pycompat.fsencode(link)
 
 
 def removedirs(name):