Mercurial > hg
changeset 39451:5bfab9400daf
state: use our CBOR module
This was the last consumer of the vendored CBOR package in
core.
Differential Revision: https://phab.mercurial-scm.org/D4471
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Tue, 04 Sep 2018 10:22:42 -0700 |
parents | 9f51fd22ed50 |
children | 481db51c83e9 |
files | mercurial/state.py |
diffstat | 1 files changed, 7 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/state.py Tue Aug 28 15:41:09 2018 -0700 +++ b/mercurial/state.py Tue Sep 04 10:22:42 2018 -0700 @@ -19,12 +19,13 @@ from __future__ import absolute_import -from .thirdparty import cbor - from . import ( error, util, ) +from .utils import ( + cborutil, +) class cmdstate(object): """a wrapper class to store the state of commands like `rebase`, `graft`, @@ -62,7 +63,8 @@ with self._repo.vfs(self.fname, 'wb', atomictemp=True) as fp: fp.write('%d\n' % version) - cbor.dump(data, fp, canonical=True) + for chunk in cborutil.streamencode(data): + fp.write(chunk) def _read(self): """reads the state file and returns a dictionary which contain @@ -73,7 +75,8 @@ except ValueError: raise error.CorruptedState("unknown version of state file" " found") - return cbor.load(fp) + + return cborutil.decodeall(fp.read())[0] def delete(self): """drop the state file if exists"""