diff --git a/mercurial/url.py b/mercurial/url.py
--- a/mercurial/url.py
+++ b/mercurial/url.py
@@ -180,6 +180,7 @@
if not proxyuser:
proxyuser = ui.config("http_proxy", "user")
proxypasswd = ui.config("http_proxy", "passwd")
+ proxypasswd = urllib.quote(proxypasswd or '', safe='')
# see if we should use a proxy for this url
no_list = ["localhost", "127.0.0.1"]
@@ -196,7 +197,7 @@
proxyurl = urlparse.urlunsplit((
proxyscheme, netlocunsplit(proxyhost, proxyport,
- proxyuser, proxypasswd or
''),
+ proxyuser, proxypasswd),
proxypath, proxyquery, proxyfrag))
proxies = {'http': proxyurl, 'https': proxyurl}
ui.debug('proxying through http://%s:%s\n' %
|