Re: [PATCH STABLE] share: handle --relative shares to a different drive letter gracefully

2017-11-04 Thread Yuya Nishihara
On Fri, 03 Nov 2017 23:32:46 -0400, Matt Harbison wrote:
> # HG changeset patch
> # User Matt Harbison 
> # Date 1509681309 14400
> #  Thu Nov 02 23:55:09 2017 -0400
> # Branch stable
> # Node ID 1683556589d30268414b8f17c67919278aa997c7
> # Parent  f445b10dc7fb3495d24d1c22b0996148864c77f7
> share: handle --relative shares to a different drive letter gracefully

Queued, thanks.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH STABLE] share: handle --relative shares to a different drive letter gracefully

2017-11-03 Thread Matt Harbison
# HG changeset patch
# User Matt Harbison 
# Date 1509681309 14400
#  Thu Nov 02 23:55:09 2017 -0400
# Branch stable
# Node ID 1683556589d30268414b8f17c67919278aa997c7
# Parent  f445b10dc7fb3495d24d1c22b0996148864c77f7
share: handle --relative shares to a different drive letter gracefully

This had the same problem as f445b10dc7fb.  Banning os.path.relpath() is
tempting, but the hint it provides is useful here.

diff --git a/mercurial/hg.py b/mercurial/hg.py
--- a/mercurial/hg.py
+++ b/mercurial/hg.py
@@ -243,7 +243,9 @@
 try:
 sharedpath = os.path.relpath(sharedpath, destvfs.base)
 requirements += 'relshared\n'
-except IOError as e:
+except (IOError, ValueError) as e:
+# ValueError is raised on Windows if the drive letters differ on
+# each path
 raise error.Abort(_('cannot calculate relative path'),
   hint=str(e))
 else:
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel