# HG changeset patch # User Matt Mackall # Date 1302120647 18000 # Node ID a3403d5b0af305079d4ca4179f453193462aba7d # Parent 14c0988c314d439206f39850af855bfb8bf2d7bd url: use a regex to hide unsupported ssh passwords (issue2754) diff -r 14c0988c314d -r a3403d5b0af3 mercurial/url.py --- a/mercurial/url.py Sun Mar 27 13:34:20 2011 +0200 +++ b/mercurial/url.py Wed Apr 06 15:10:47 2011 -0500 @@ -25,6 +25,9 @@ def hidepassword(url): '''hide user credential in a url string''' + if url.startswith("ssh://"): + # urllib doesn't know about ssh urls + return re.sub(r'(ssh://[^/]+):[^/]+(@.*)', r'\1:***\2', url) scheme, netloc, path, params, query, fragment = urlparse.urlparse(url) netloc = re.sub('([^:]*):([^@]*)@(.*)', r'\1:***@\3', netloc) return _urlunparse(scheme, netloc, path, params, query, fragment, url)