Show More
@@ -19,12 +19,13 b' to serialize and deserialize data.' | |||
|
19 | 19 | |
|
20 | 20 | from __future__ import absolute_import |
|
21 | 21 | |
|
22 | from .thirdparty import cbor | |
|
23 | ||
|
24 | 22 | from . import ( |
|
25 | 23 | error, |
|
26 | 24 | util, |
|
27 | 25 | ) |
|
26 | from .utils import ( | |
|
27 | cborutil, | |
|
28 | ) | |
|
28 | 29 | |
|
29 | 30 | class cmdstate(object): |
|
30 | 31 | """a wrapper class to store the state of commands like `rebase`, `graft`, |
@@ -62,7 +63,8 b' class cmdstate(object):' | |||
|
62 | 63 | |
|
63 | 64 | with self._repo.vfs(self.fname, 'wb', atomictemp=True) as fp: |
|
64 | 65 | fp.write('%d\n' % version) |
|
65 | cbor.dump(data, fp, canonical=True) | |
|
66 | for chunk in cborutil.streamencode(data): | |
|
67 | fp.write(chunk) | |
|
66 | 68 | |
|
67 | 69 | def _read(self): |
|
68 | 70 | """reads the state file and returns a dictionary which contain |
@@ -73,7 +75,8 b' class cmdstate(object):' | |||
|
73 | 75 | except ValueError: |
|
74 | 76 | raise error.CorruptedState("unknown version of state file" |
|
75 | 77 | " found") |
|
76 | return cbor.load(fp) | |
|
78 | ||
|
79 | return cborutil.decodeall(fp.read())[0] | |
|
77 | 80 | |
|
78 | 81 | def delete(self): |
|
79 | 82 | """drop the state file if exists""" |
General Comments 0
You need to be logged in to leave comments.
Login now