comparison mercurial/debugcommands.py @ 39449:e5eb67dea6e8

debugcommands: use our CBOR decoder It implements the set of CBOR needed for the wire protocol. Differential Revision: https://phab.mercurial-scm.org/D4469
author Gregory Szorc <gregory.szorc@gmail.com>
date Tue, 28 Aug 2018 15:37:55 -0700
parents 0f549da54379
children d06834e0f48e
comparison
equal deleted inserted replaced
39448:660879e49b46 39449:e5eb67dea6e8
29 hex, 29 hex,
30 nullhex, 30 nullhex,
31 nullid, 31 nullid,
32 nullrev, 32 nullrev,
33 short, 33 short,
34 )
35 from .thirdparty import (
36 cbor,
37 ) 34 )
38 from . import ( 35 from . import (
39 bundle2, 36 bundle2,
40 changegroup, 37 changegroup,
41 cmdutil, 38 cmdutil,
81 wireprotoframing, 78 wireprotoframing,
82 wireprotoserver, 79 wireprotoserver,
83 wireprotov2peer, 80 wireprotov2peer,
84 ) 81 )
85 from .utils import ( 82 from .utils import (
83 cborutil,
86 dateutil, 84 dateutil,
87 procutil, 85 procutil,
88 stringutil, 86 stringutil,
89 ) 87 )
90 88
3319 getattr(e, 'read', lambda: None)() 3317 getattr(e, 'read', lambda: None)()
3320 continue 3318 continue
3321 3319
3322 if res.headers.get('Content-Type') == 'application/mercurial-cbor': 3320 if res.headers.get('Content-Type') == 'application/mercurial-cbor':
3323 ui.write(_('cbor> %s\n') % 3321 ui.write(_('cbor> %s\n') %
3324 stringutil.pprint(cbor.loads(body), bprefix=True, 3322 stringutil.pprint(cborutil.decodeall(body)[0],
3323 bprefix=True,
3325 indent=2)) 3324 indent=2))
3326 3325
3327 elif action == 'close': 3326 elif action == 'close':
3328 peer.close() 3327 peer.close()
3329 elif action == 'readavailable': 3328 elif action == 'readavailable':