[PATCH 2 of 2] py3: use bytes() to byte-stringify url object in url.py

Yuya Nishihara yuya at tcha.org
Sun Feb 18 08:55:10 EST 2018


# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1518959605 -32400
#      Sun Feb 18 22:13:25 2018 +0900
# Node ID b7ebed58e716806e5789779090bc054e98fb43e2
# Parent  20fd00ae43f25ab4db11bafc909a6a659bb74cbe
py3: use bytes() to byte-stringify url object in url.py

Perhaps we'll have to convert it back and forth from/to bytes and unicode
at urllib boundary, but at least util.hidepassword() wants a byte string.

diff --git a/mercurial/url.py b/mercurial/url.py
--- a/mercurial/url.py
+++ b/mercurial/url.py
@@ -71,10 +71,10 @@ class passwordmgr(object):
             u.query = None
             if not self.ui.interactive():
                 raise error.Abort(_('http authorization required for %s') %
-                                 util.hidepassword(str(u)))
+                                  util.hidepassword(bytes(u)))
 
             self.ui.write(_("http authorization required for %s\n") %
-                          util.hidepassword(str(u)))
+                          util.hidepassword(bytes(u)))
             self.ui.write(_("realm: %s\n") % realm)
             if user:
                 self.ui.write(_("user: %s\n") % user)
@@ -124,7 +124,7 @@ class proxyhandler(urlreq.proxyhandler):
             else:
                 self.no_list = no_list
 
-            proxyurl = str(proxy)
+            proxyurl = bytes(proxy)
             proxies = {'http': proxyurl, 'https': proxyurl}
             ui.debug('proxying through %s\n' % util.hidepassword(proxyurl))
         else:


More information about the Mercurial-devel mailing list