[Updated] D11333: windows: degrade to py2 behavior when reading a non-symlink as a symlink

mharbison72 (Matt Harbison) phabricator at mercurial-scm.org
Wed Aug 25 10:08:25 UTC 2021


Closed by commit rHG9c67faf2e28e: windows: degrade to py2 behavior when reading a non-symlink as a symlink (authored by mharbison72).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D11333?vs=29987&id=30013

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D11333/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D11333

AFFECTED FILES
  mercurial/windows.py

CHANGE DETAILS

diff --git a/mercurial/windows.py b/mercurial/windows.py
--- a/mercurial/windows.py
+++ b/mercurial/windows.py
@@ -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):



To: mharbison72, #hg-reviewers, Alphare
Cc: mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20210825/4dd6a31a/attachment-0002.html>


More information about the Mercurial-patches mailing list