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): | ||||
|         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): | ||||
|   | ||||
| @@ -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']) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Carlos Martín Nieto
					Carlos Martín Nieto