diff --git a/mercurial/ui.py b/mercurial/ui.py --- a/mercurial/ui.py +++ b/mercurial/ui.py @@ -135,6 +135,19 @@ """, } +def _maybestrurl(maybebytes): + if maybebytes is None: + return None + if pycompat.ispy3: + return pycompat.strurl(maybebytes) + return maybebytes + +def _maybebytesurl(maybestr): + if maybestr is None: + return None + if pycompat.ispy3: + return pycompat.bytesurl(maybestr) + return maybestr class httppasswordmgrdbproxy(object): """Delays loading urllib2 until it's needed.""" @@ -147,10 +160,18 @@ return self._mgr def add_password(self, realm, uris, user, passwd): - return self._get_mgr().add_password(realm, uris, user, passwd) + if isinstance(uris, tuple): + uris = tuple(_maybestrurl(u) for u in uris) + else: + uris = _maybestrurl(uris) + return self._get_mgr().add_password( + _maybestrurl(realm), uris, + _maybestrurl(user), _maybestrurl(passwd)) def find_user_password(self, realm, uri): - return self._get_mgr().find_user_password(realm, uri) + return tuple(_maybebytesurl(v) for v in + self._get_mgr().find_user_password(_maybestrurl(realm), + _maybestrurl(uri))) def _catchterm(*args): raise error.SignalInterrupt