D4470: wireprotov2peer: use our CBOR decoder

indygreg (Gregory Szorc) phabricator at mercurial-scm.org
Wed Sep 5 08:23:34 EDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rHG9f51fd22ed50: wireprotov2peer: use our CBOR decoder (authored by indygreg, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D4470?vs=10767&id=10787

REVISION DETAIL
  https://phab.mercurial-scm.org/D4470

AFFECTED FILES
  mercurial/wireprotov2peer.py

CHANGE DETAILS

diff --git a/mercurial/wireprotov2peer.py b/mercurial/wireprotov2peer.py
--- a/mercurial/wireprotov2peer.py
+++ b/mercurial/wireprotov2peer.py
@@ -8,15 +8,15 @@
 from __future__ import absolute_import
 
 from .i18n import _
-from .thirdparty import (
-    cbor,
-)
 from . import (
     encoding,
     error,
     util,
     wireprotoframing,
 )
+from .utils import (
+    cborutil,
+)
 
 def formatrichmessage(atoms):
     """Format an encoded message from the framing protocol."""
@@ -44,13 +44,10 @@
 
     def cborobjects(self):
         """Obtain decoded CBOR objects from this response."""
-        size = self.b.tell()
         self.b.seek(0)
 
-        decoder = cbor.CBORDecoder(self.b)
-
-        while self.b.tell() < size:
-            yield decoder.decode()
+        for v in cborutil.decodeall(self.b.getvalue()):
+            yield v
 
 class clienthandler(object):
     """Object to handle higher-level client activities.



To: indygreg, #hg-reviewers, pulkit
Cc: mercurial-devel


More information about the Mercurial-devel mailing list