Mercurial > public > mercurial-scm > hg
comparison mercurial/debugcommands.py @ 39956:36e9d2c60837
py3: use system strings for HTTP response header comparison
res.headers is holding system strings. Attempting to compare against
bytes always fails and we fail to print decoded CBOR responses on
Python 3.
After this change, various test-wireproto* tests are now properly
printing CBOR response objects.
Differential Revision: https://phab.mercurial-scm.org/D4835
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Mon, 01 Oct 2018 23:11:07 -0700 |
parents | c421c22d3ad2 |
children | d71e0ba34d9b |
comparison
equal
deleted
inserted
replaced
39955:c421c22d3ad2 | 39956:36e9d2c60837 |
---|---|
3322 except util.urlerr.urlerror as e: | 3322 except util.urlerr.urlerror as e: |
3323 # read() method must be called, but only exists in Python 2 | 3323 # read() method must be called, but only exists in Python 2 |
3324 getattr(e, 'read', lambda: None)() | 3324 getattr(e, 'read', lambda: None)() |
3325 continue | 3325 continue |
3326 | 3326 |
3327 if res.headers.get('Content-Type') == 'application/mercurial-cbor': | 3327 ct = res.headers.get(r'Content-Type') |
3328 if ct == r'application/mercurial-cbor': | |
3328 ui.write(_('cbor> %s\n') % | 3329 ui.write(_('cbor> %s\n') % |
3329 stringutil.pprint(cborutil.decodeall(body)[0], | 3330 stringutil.pprint(cborutil.decodeall(body)[0], |
3330 bprefix=True, | 3331 bprefix=True, |
3331 indent=2)) | 3332 indent=2)) |
3332 | 3333 |