# HG changeset patch # User Matt Harbison # Date 2021-04-08 22:43:08 # Node ID 218a26df7813fee76632a483860f54cd09798a13 # Parent 6d5a26e94d9ee9816f1b9a45b22f55ed1b2b7ab0 share: store relative share paths with '/' separators I created a relative share in Windows and tried to use it in WSL, and it failed: abort: .hg/sharedpath points to nonexistent directory /mnt/c/Users/Matt/hg-review/.hg/..\..\hg\.hg Use `normpath` on the read side so that the code has the usual Windows style paths it always had (I don't think that matters much), but it also eliminates the directory escaping path components in the case where the path is printed. This will not fix repositories that have already been created, but it's trivial enough to hand edit the file to correct it. Differential Revision: https://phab.mercurial-scm.org/D10330 diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -469,7 +469,7 @@ def _getsharedvfs(hgvfs, requirements): # ``.hg/`` for ``relshared``. sharedpath = hgvfs.read(b'sharedpath').rstrip(b'\n') if requirementsmod.RELATIVE_SHARED_REQUIREMENT in requirements: - sharedpath = hgvfs.join(sharedpath) + sharedpath = util.normpath(hgvfs.join(sharedpath)) sharedvfs = vfsmod.vfs(sharedpath, realpath=True) @@ -3672,6 +3672,7 @@ def createrepository(ui, path, createopt if createopts.get(b'sharedrelative'): try: sharedpath = os.path.relpath(sharedpath, hgvfs.base) + sharedpath = util.pconvert(sharedpath) except (IOError, ValueError) as e: # ValueError is raised on Windows if the drive letters differ # on each path.