Mercurial > public > mercurial-scm > hg
comparison mercurial/util.py @ 37873:bb1b15acfd06
util: make util.url __repr__ consistent on Python 2 and 3
Differential Revision: https://phab.mercurial-scm.org/D3468
author | Augie Fackler <augie@google.com> |
---|---|
date | Fri, 27 Apr 2018 00:06:08 -0400 |
parents | 8fb9985382be |
children | 8298e55fc9a4 |
comparison
equal
deleted
inserted
replaced
37872:51a2f8d199c7 | 37873:bb1b15acfd06 |
---|---|
2715 attrs = [] | 2715 attrs = [] |
2716 for a in ('scheme', 'user', 'passwd', 'host', 'port', 'path', | 2716 for a in ('scheme', 'user', 'passwd', 'host', 'port', 'path', |
2717 'query', 'fragment'): | 2717 'query', 'fragment'): |
2718 v = getattr(self, a) | 2718 v = getattr(self, a) |
2719 if v is not None: | 2719 if v is not None: |
2720 attrs.append('%s: %r' % (a, v)) | 2720 attrs.append('%s: %r' % (a, pycompat.bytestr(v))) |
2721 return '<url %s>' % ', '.join(attrs) | 2721 return '<url %s>' % ', '.join(attrs) |
2722 | 2722 |
2723 def __bytes__(self): | 2723 def __bytes__(self): |
2724 r"""Join the URL's components back into a URL string. | 2724 r"""Join the URL's components back into a URL string. |
2725 | 2725 |