config: only return the config key in iteration
At its core, the config is a key-value storage with peculiar key equality rules. Make it behave more like a python dictionary and return the key on iteration.
This commit is contained in:
@@ -62,9 +62,8 @@ class ConfigIterator(object):
|
|||||||
def __next__(self):
|
def __next__(self):
|
||||||
entry = self._next_entry()
|
entry = self._next_entry()
|
||||||
name = ffi.string(entry.name).decode('utf-8')
|
name = ffi.string(entry.name).decode('utf-8')
|
||||||
value = ffi.string(entry.value).decode('utf-8')
|
|
||||||
|
|
||||||
return name, value
|
return name
|
||||||
|
|
||||||
|
|
||||||
class ConfigMultivarIterator(ConfigIterator):
|
class ConfigMultivarIterator(ConfigIterator):
|
||||||
|
@@ -173,8 +173,8 @@ class ConfigTest(utils.RepoTestCase):
|
|||||||
config = self.repo.config
|
config = self.repo.config
|
||||||
lst = {}
|
lst = {}
|
||||||
|
|
||||||
for name, value in config:
|
for name in config:
|
||||||
lst[name] = value
|
lst[name] = config[name]
|
||||||
|
|
||||||
self.assertTrue('core.bare' in lst)
|
self.assertTrue('core.bare' in lst)
|
||||||
self.assertTrue(lst['core.bare'])
|
self.assertTrue(lst['core.bare'])
|
||||||
|
Reference in New Issue
Block a user