Details
Details
- Reviewers
- None
- Group Reviewers
hg-reviewers - Commits
- rHGbb1b15acfd06: util: make util.url __repr__ consistent on Python 2 and 3
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
hg-reviewers |
Lint Skipped |
Unit Tests Skipped |
Path | Packages | |||
---|---|---|---|---|
M | mercurial/util.py (2 lines) |
Commit | Parents | Author | Summary | Date |
---|---|---|---|---|
Augie Fackler | Apr 27 2018, 12:06 AM |
@encoding.strmethod | @encoding.strmethod | ||||
def __repr__(self): | def __repr__(self): | ||||
attrs = [] | attrs = [] | ||||
for a in ('scheme', 'user', 'passwd', 'host', 'port', 'path', | for a in ('scheme', 'user', 'passwd', 'host', 'port', 'path', | ||||
'query', 'fragment'): | 'query', 'fragment'): | ||||
v = getattr(self, a) | v = getattr(self, a) | ||||
if v is not None: | if v is not None: | ||||
attrs.append('%s: %r' % (a, v)) | attrs.append('%s: %r' % (a, pycompat.bytestr(v))) | ||||
return '<url %s>' % ', '.join(attrs) | return '<url %s>' % ', '.join(attrs) | ||||
def __bytes__(self): | def __bytes__(self): | ||||
r"""Join the URL's components back into a URL string. | r"""Join the URL's components back into a URL string. | ||||
Examples: | Examples: | ||||
>>> bytes(url(b'http://user:pw@host:80/c:/bob?fo:oo#ba:ar')) | >>> bytes(url(b'http://user:pw@host:80/c:/bob?fo:oo#ba:ar')) |