Class to manage local git configs.
Definition at line 17 of file git_utils.py.
◆ __init__()
def git_utils.GitLocalConfig.__init__ |
( |
|
self, |
|
|
|
config_dict |
|
) |
| |
Definition at line 19 of file git_utils.py.
19 def __init__(self, config_dict):
20 self._config_dict = config_dict
21 self._previous_values = {}
22
◆ __enter__()
def git_utils.GitLocalConfig.__enter__ |
( |
|
self | ) |
|
Definition at line 23 of file git_utils.py.
23 def __enter__(self):
24 for k, v in self._config_dict.items():
25 try:
26 prev = subprocess.check_output([
27 'git',
'config',
'--local', k]).
decode(
'utf-8').rstrip()
28 if prev:
29 self._previous_values[k] = prev
30 except subprocess.CalledProcessError:
31
32 pass
33 subprocess.check_call(['git', 'config', '--local', k, v])
34
static DecodeResult decode(std::string path)
◆ __exit__()
def git_utils.GitLocalConfig.__exit__ |
( |
|
self, |
|
|
|
exc_type, |
|
|
|
_value, |
|
|
|
_traceback |
|
) |
| |
Definition at line 35 of file git_utils.py.
35 def __exit__(self, exc_type, _value, _traceback):
36 for k in self._config_dict:
37 if self._previous_values.
get(k):
38 subprocess.check_call(
39 ['git', 'config', '--local', k, self._previous_values[k]])
40 else:
41 subprocess.check_call(['git', 'config', '--local', '--unset', k])
42
43
const myers::Point & get(const myers::Segment &)
The documentation for this class was generated from the following file: