Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | List of all members
git_utils.GitLocalConfig Class Reference
Inheritance diagram for git_utils.GitLocalConfig:

Public Member Functions

 __init__ (self, config_dict)
 
 __enter__ (self)
 
 __exit__ (self, exc_type, _value, _traceback)
 

Protected Attributes

 _config_dict
 
 _previous_values
 

Detailed Description

Class to manage local git configs.

Definition at line 17 of file git_utils.py.

Constructor & Destructor Documentation

◆ __init__()

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

Member Function Documentation

◆ __enter__()

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 # We are probably here because the key did not exist in the config.
32 pass
33 subprocess.check_call(['git', 'config', '--local', k, v])
34
static DecodeResult decode(std::string path)

◆ __exit__()

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

Member Data Documentation

◆ _config_dict

git_utils.GitLocalConfig._config_dict
protected

Definition at line 20 of file git_utils.py.

◆ _previous_values

git_utils.GitLocalConfig._previous_values
protected

Definition at line 21 of file git_utils.py.


The documentation for this class was generated from the following file: