Mercurial > hg
comparison mercurial/wireprotoserver.py @ 39447:5f4a9ada5ab5
wireprotoserver: use our CBOR encoder
Moving away from the vendored package.
Again, our encoder normalizes keys differently from the vendored
package (for now), hence the test changes.
Differential Revision: https://phab.mercurial-scm.org/D4467
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Tue, 28 Aug 2018 18:05:48 -0700 |
parents | e7aa113b14f7 |
children | a9f56e4501c1 |
comparison
equal
deleted
inserted
replaced
39446:36f487a332ad | 39447:5f4a9ada5ab5 |
---|---|
10 import struct | 10 import struct |
11 import sys | 11 import sys |
12 import threading | 12 import threading |
13 | 13 |
14 from .i18n import _ | 14 from .i18n import _ |
15 from .thirdparty import ( | |
16 cbor, | |
17 ) | |
18 from . import ( | 15 from . import ( |
19 encoding, | 16 encoding, |
20 error, | 17 error, |
21 pycompat, | 18 pycompat, |
22 util, | 19 util, |
23 wireprototypes, | 20 wireprototypes, |
24 wireprotov1server, | 21 wireprotov1server, |
25 wireprotov2server, | 22 wireprotov2server, |
26 ) | 23 ) |
27 from .utils import ( | 24 from .utils import ( |
25 cborutil, | |
28 interfaceutil, | 26 interfaceutil, |
29 procutil, | 27 procutil, |
30 ) | 28 ) |
31 | 29 |
32 stringio = util.stringio | 30 stringio = util.stringio |
387 'v1capabilities': v1caps.data, | 385 'v1capabilities': v1caps.data, |
388 } | 386 } |
389 | 387 |
390 res.status = b'200 OK' | 388 res.status = b'200 OK' |
391 res.headers[b'Content-Type'] = b'application/mercurial-cbor' | 389 res.headers[b'Content-Type'] = b'application/mercurial-cbor' |
392 res.setbodybytes(cbor.dumps(m, canonical=True)) | 390 res.setbodybytes(b''.join(cborutil.streamencode(m))) |
393 | 391 |
394 return True | 392 return True |
395 | 393 |
396 def _callhttp(repo, req, res, proto, cmd): | 394 def _callhttp(repo, req, res, proto, cmd): |
397 # Avoid cycle involving hg module. | 395 # Avoid cycle involving hg module. |