Mercurial > evolve
changeset 3572:7934e9751d69
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.
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Mon, 19 Mar 2018 13:11:55 +0530 |
parents | 34330381b76b |
children | d53277cdc1e7 |
files | hgext3rd/evolve/state.py |
diffstat | 1 files changed, 4 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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()