[Request] [+ ] D10330: share: store relative share paths with '/' separators

mharbison72 (Matt Harbison) phabricator at mercurial-scm.org
Thu Apr 8 23:53:04 UTC 2021


mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  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.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/localrepo.py

CHANGE DETAILS

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -469,7 +469,7 @@
     # ``.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 @@
         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.



To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mercurial-scm.org/pipermail/mercurial-patches/attachments/20210408/49ef538c/attachment.html>


More information about the Mercurial-patches mailing list