diff -r 940c05b25b07 -r 81d38478fced mercurial/util.py --- a/mercurial/util.py Fri Oct 07 08:51:50 2016 -0700 +++ b/mercurial/util.py Fri Oct 07 17:06:55 2016 +0200 @@ -2301,26 +2301,6 @@ _hextochr = dict((a + b, chr(int(a + b, 16))) for a in string.hexdigits for b in string.hexdigits) -def _urlunquote(s): - """Decode HTTP/HTML % encoding. - - >>> _urlunquote('abc%20def') - 'abc def' - """ - res = s.split('%') - # fastpath - if len(res) == 1: - return s - s = res[0] - for item in res[1:]: - try: - s += _hextochr[item[:2]] + item[2:] - except KeyError: - s += '%' + item - except UnicodeDecodeError: - s += unichr(int(item[:2], 16)) + item[2:] - return s - class url(object): r"""Reliable URL parser. @@ -2489,7 +2469,7 @@ 'path', 'fragment'): v = getattr(self, a) if v is not None: - setattr(self, a, _urlunquote(v)) + setattr(self, a, pycompat.urlparse.unquote(v)) def __repr__(self): attrs = []