comparison mercurial/config.py @ 27696:e70c97cc9243

config: add hasconfig method and supporting plumbing We add the hasconfig method to make it possible to distinguish between a config value that was never supplied and one that is empty.
author Bryan O'Sullivan <bos@serpentine.com>
date Thu, 07 Jan 2016 19:45:03 -0800
parents a027a0813b44
children 954002426f78
comparison
equal deleted inserted replaced
27695:fb0cc863d172 27696:e70c97cc9243
28 self._source = data._source.copy() 28 self._source = data._source.copy()
29 def copy(self): 29 def copy(self):
30 return config(self) 30 return config(self)
31 def __contains__(self, section): 31 def __contains__(self, section):
32 return section in self._data 32 return section in self._data
33 def hasitem(self, section, item):
34 return item in self._data.get(section, {})
33 def __getitem__(self, section): 35 def __getitem__(self, section):
34 return self._data.get(section, {}) 36 return self._data.get(section, {})
35 def __iter__(self): 37 def __iter__(self):
36 for d in self.sections(): 38 for d in self.sections():
37 yield d 39 yield d