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
--- 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):