simplestorerepo: migrate to in-hg CBOR code
authorAugie Fackler <augie@google.com>
Mon, 07 Jan 2019 16:50:23 -0500
changeset 41158 ad51e6117095
parent 41157 c4639fdae1b9
child 41159 23d5e03dad70
simplestorerepo: migrate to in-hg CBOR code This is the only use of thirdparty.cbor outside of a test-* file, so it felt worthwhile to clean it up. Differential Revision: https://phab.mercurial-scm.org/D5520
tests/simplestorerepo.py
--- a/tests/simplestorerepo.py	Mon Jan 07 18:22:20 2019 -0500
+++ b/tests/simplestorerepo.py	Mon Jan 07 16:50:23 2019 -0500
@@ -23,7 +23,6 @@
 )
 from mercurial.thirdparty import (
     attr,
-    cbor,
 )
 from mercurial import (
     ancestor,
@@ -39,6 +38,7 @@
     verify,
 )
 from mercurial.utils import (
+    cborutil,
     interfaceutil,
     storageutil,
 )
@@ -106,7 +106,7 @@
 
         indexdata = self._svfs.tryread(self._indexpath)
         if indexdata:
-            indexdata = cbor.loads(indexdata)
+            indexdata = cborutil.decodeall(indexdata)
 
         self._indexdata = indexdata or []
         self._indexbynode = {}
@@ -513,7 +513,8 @@
 
     def _reflectindexupdate(self):
         self._refreshindex()
-        self._svfs.write(self._indexpath, cbor.dumps(self._indexdata))
+        self._svfs.write(self._indexpath,
+                         ''.join(cborutil.streamencode(self._indexdata)))
 
     def addgroup(self, deltas, linkmapper, transaction, addrevisioncb=None,
                  maybemissingparents=False):