##// END OF EJS Templates
state: don't have a dict like interface for cmdstate class...
Pulkit Goyal -
r38116:36a5a123 default
parent child Browse files
Show More
@@ -46,31 +46,12 b' class cmdstate(object):'
46 46 """
47 47 self._repo = repo
48 48 self.fname = fname
49 if not opts:
50 self.opts = {}
51 else:
52 self.opts = opts
53
54 def __nonzero__(self):
55 return self.exists()
56
57 def __getitem__(self, key):
58 return self.opts[key]
59 49
60 def __setitem__(self, key, value):
61 updates = {key: value}
62 self.opts.update(updates)
50 def read(self):
51 """read the existing state file and return a dict of data stored"""
52 return self._read()
63 53
64 def load(self):
65 """load the existing state file into the class object"""
66 op = self._read()
67 self.opts.update(op)
68
69 def addopts(self, opts):
70 """add more key-value pairs to the data stored by the object"""
71 self.opts.update(opts)
72
73 def save(self):
54 def save(self, data):
74 55 """write all the state data stored to .hg/<filename> file
75 56
76 57 we use third-party library cbor to serialize data to write in the file.
General Comments 0
You need to be logged in to leave comments. Login now