[PATCH 2 of 3] py3: appease urllib.request.pathname2url() with a str in Windows

Matt Harbison mharbison72 at gmail.com
Sun Oct 14 12:41:54 EDT 2018


# HG changeset patch
# User Matt Harbison <matt_harbison at yahoo.com>
# Date 1539492655 14400
#      Sun Oct 14 00:50:55 2018 -0400
# Node ID 8b25e88b588d5be2b6a511d4f76e3c0230122e10
# Parent  edf769c43bbb10048dceed4cc2ddd46197943ff3
py3: appease urllib.request.pathname2url() with a str in Windows

This fixes test-extdata.t on Windows.  Presumably url2pathname() needs a similar
fix, but that's only used in svn conversions, and I don't have svn installed.

diff --git a/mercurial/url.py b/mercurial/url.py
--- a/mercurial/url.py
+++ b/mercurial/url.py
@@ -598,7 +598,8 @@ def open(ui, url_, data=None):
         url_, authinfo = u.authinfo()
     else:
         path = util.normpath(os.path.abspath(url_))
-        url_ = 'file://' + pycompat.bytesurl(urlreq.pathname2url(path))
+        p2url = urlreq.pathname2url
+        url_ = 'file://' + pycompat.bytesurl(p2url(encoding.tonativestr(path)))
         authinfo = None
     return opener(ui, authinfo).open(pycompat.strurl(url_), data)
 


More information about the Mercurial-devel mailing list