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:
Carlos Martín Nieto
2014-07-24 18:43:54 +02:00
parent e437e13182
commit 2a429aae98
2 changed files with 3 additions and 4 deletions

View File

@@ -62,9 +62,8 @@ class ConfigIterator(object):
def __next__(self):
entry = self._next_entry()
name = ffi.string(entry.name).decode('utf-8')
value = ffi.string(entry.value).decode('utf-8')
return name, value
return name
class ConfigMultivarIterator(ConfigIterator):

View File

@@ -173,8 +173,8 @@ class ConfigTest(utils.RepoTestCase):
config = self.repo.config
lst = {}
for name, value in config:
lst[name] = value
for name in config:
lst[name] = config[name]
self.assertTrue('core.bare' in lst)
self.assertTrue(lst['core.bare'])