comparison mercurial/debugcommands.py @ 39065:730e7d92a023

debugcommands: urlerror only has a read() method in Python 2 Differential Revision: https://phab.mercurial-scm.org/D4258
author Augie Fackler <augie@google.com>
date Fri, 10 Aug 2018 03:33:38 -0400
parents a2fa7247ca70
children 5c99486fcfe1
comparison
equal deleted inserted replaced
39064:a2fa7247ca70 39065:730e7d92a023
3205 3205
3206 try: 3206 try:
3207 res = opener.open(req) 3207 res = opener.open(req)
3208 body = res.read() 3208 body = res.read()
3209 except util.urlerr.urlerror as e: 3209 except util.urlerr.urlerror as e:
3210 e.read() 3210 # read() method must be called, but only exists in Python 2
3211 getattr(e, 'read', lambda: None)()
3211 continue 3212 continue
3212 3213
3213 if res.headers.get('Content-Type') == 'application/mercurial-cbor': 3214 if res.headers.get('Content-Type') == 'application/mercurial-cbor':
3214 ui.write(_('cbor> %s\n') % 3215 ui.write(_('cbor> %s\n') %
3215 stringutil.pprint(cbor.loads(body), bprefix=True)) 3216 stringutil.pprint(cbor.loads(body), bprefix=True))