state: add __setitem__() for cmdstate class
Adding __setitem__() will help us in setting the value of variables stored in
state files using `state[key] = value` in our code which is very convenient.
--- a/hgext3rd/evolve/state.py Mon Mar 19 12:58:31 2018 +0530
+++ b/hgext3rd/evolve/state.py Mon Mar 19 13:11:55 2018 +0530
@@ -48,6 +48,10 @@
def __getitem__(self, key):
return self.opts[key]
+ def __setitem__(self, key, value):
+ updates = {key: value}
+ self.opts.update(updates)
+
def load(self):
"""load the existing evolvestate file into the class object"""
op = self._read()