]> git.ipfire.org Git - ipfire.org.git/blame - source/git/config.py
Imported pygit (repository is down?!).
[ipfire.org.git] / source / git / config.py
CommitLineData
727e2055
MT
1# -*- coding: utf-8 -*- ex:set ts=4 sw=4 et:
2
3# Copyright © 2008 - Steve Frécinaux
4# License: LGPL 2
5
6class Config(dict):
7 def __init__(self, repo):
8 dict.__init__(self)
9 self._repo = repo
10 self._load()
11
12 def _load(self):
13 self._data = {}
14 for line in self._repo.run('config', '--list'):
15 key, value = line.strip().split('=', 1)
16 dict.__setitem__(self, key, value.decode('utf-8'))
17
18 def __setitem__(self, key, value):
19 dict.__setitem__(self, key, value)
20 # update the repo config
21 self._repo.run.run_noio(['config', 'key', str(value)])
22
23if __name__ == '__main__':
24 conf = Config()