mercurial/config.py
changeset 48890 f5127b87f160
parent 48875 6000f5b25c9b
child 48920 b4ab4fd23199
equal deleted inserted replaced
48889:9baec00b4ca1 48890:f5127b87f160
   112     def items(self, section):
   112     def items(self, section):
   113         items = pycompat.iteritems(self._data.get(section, {}))
   113         items = pycompat.iteritems(self._data.get(section, {}))
   114         return [(k, v[0]) for (k, v) in items]
   114         return [(k, v[0]) for (k, v) in items]
   115 
   115 
   116     def set(self, section, item, value, source=b""):
   116     def set(self, section, item, value, source=b""):
   117         if pycompat.ispy3:
   117         assert not isinstance(
   118             assert not isinstance(
   118             section, str
   119                 section, str
   119         ), b'config section may not be unicode strings on Python 3'
   120             ), b'config section may not be unicode strings on Python 3'
   120         assert not isinstance(
   121             assert not isinstance(
   121             item, str
   122                 item, str
   122         ), b'config item may not be unicode strings on Python 3'
   123             ), b'config item may not be unicode strings on Python 3'
   123         assert not isinstance(
   124             assert not isinstance(
   124             value, str
   125                 value, str
   125         ), b'config values may not be unicode strings on Python 3'
   126             ), b'config values may not be unicode strings on Python 3'
       
   127         if section not in self:
   126         if section not in self:
   128             self._data[section] = util.cowsortdict()
   127             self._data[section] = util.cowsortdict()
   129         else:
   128         else:
   130             self._data[section] = self._data[section].preparewrite()
   129             self._data[section] = self._data[section].preparewrite()
   131         self._data[section][item] = (value, source, self._current_source_level)
   130         self._data[section][item] = (value, source, self._current_source_level)