summaryrefslogtreecommitdiffstats
path: root/git_config.py
diff options
context:
space:
mode:
Diffstat (limited to 'git_config.py')
-rw-r--r--git_config.py24
1 files changed, 12 insertions, 12 deletions
diff --git a/git_config.py b/git_config.py
index 8de3200c..8311d9f0 100644
--- a/git_config.py
+++ b/git_config.py
@@ -85,13 +85,13 @@ class GitConfig(object):
85 @classmethod 85 @classmethod
86 def ForUser(cls): 86 def ForUser(cls):
87 if cls._ForUser is None: 87 if cls._ForUser is None:
88 cls._ForUser = cls(configfile = os.path.expanduser('~/.gitconfig')) 88 cls._ForUser = cls(configfile=os.path.expanduser('~/.gitconfig'))
89 return cls._ForUser 89 return cls._ForUser
90 90
91 @classmethod 91 @classmethod
92 def ForRepository(cls, gitdir, defaults=None): 92 def ForRepository(cls, gitdir, defaults=None):
93 return cls(configfile = os.path.join(gitdir, 'config'), 93 return cls(configfile=os.path.join(gitdir, 'config'),
94 defaults = defaults) 94 defaults=defaults)
95 95
96 def __init__(self, configfile, defaults=None, jsonFile=None): 96 def __init__(self, configfile, defaults=None, jsonFile=None):
97 self.file = configfile 97 self.file = configfile
@@ -107,13 +107,13 @@ class GitConfig(object):
107 os.path.dirname(self.file), 107 os.path.dirname(self.file),
108 '.repo_' + os.path.basename(self.file) + '.json') 108 '.repo_' + os.path.basename(self.file) + '.json')
109 109
110 def Has(self, name, include_defaults = True): 110 def Has(self, name, include_defaults=True):
111 """Return true if this configuration file has the key. 111 """Return true if this configuration file has the key.
112 """ 112 """
113 if _key(name) in self._cache: 113 if _key(name) in self._cache:
114 return True 114 return True
115 if include_defaults and self.defaults: 115 if include_defaults and self.defaults:
116 return self.defaults.Has(name, include_defaults = True) 116 return self.defaults.Has(name, include_defaults=True)
117 return False 117 return False
118 118
119 def GetBoolean(self, name): 119 def GetBoolean(self, name):
@@ -142,7 +142,7 @@ class GitConfig(object):
142 v = self._cache[_key(name)] 142 v = self._cache[_key(name)]
143 except KeyError: 143 except KeyError:
144 if self.defaults: 144 if self.defaults:
145 return self.defaults.GetString(name, all_keys = all_keys) 145 return self.defaults.GetString(name, all_keys=all_keys)
146 v = [] 146 v = []
147 147
148 if not all_keys: 148 if not all_keys:
@@ -153,7 +153,7 @@ class GitConfig(object):
153 r = [] 153 r = []
154 r.extend(v) 154 r.extend(v)
155 if self.defaults: 155 if self.defaults:
156 r.extend(self.defaults.GetString(name, all_keys = True)) 156 r.extend(self.defaults.GetString(name, all_keys=True))
157 return r 157 return r
158 158
159 def SetString(self, name, value): 159 def SetString(self, name, value):
@@ -217,7 +217,7 @@ class GitConfig(object):
217 """ 217 """
218 return self._sections.get(section, set()) 218 return self._sections.get(section, set())
219 219
220 def HasSection(self, section, subsection = ''): 220 def HasSection(self, section, subsection=''):
221 """Does at least one key in section.subsection exist? 221 """Does at least one key in section.subsection exist?
222 """ 222 """
223 try: 223 try:
@@ -323,8 +323,8 @@ class GitConfig(object):
323 323
324 p = GitCommand(None, 324 p = GitCommand(None,
325 command, 325 command,
326 capture_stdout = True, 326 capture_stdout=True,
327 capture_stderr = True) 327 capture_stderr=True)
328 if p.Wait() == 0: 328 if p.Wait() == 0:
329 return p.stdout 329 return p.stdout
330 else: 330 else:
@@ -731,7 +731,7 @@ class Remote(object):
731 731
732 def _Get(self, key, all_keys=False): 732 def _Get(self, key, all_keys=False):
733 key = 'remote.%s.%s' % (self.name, key) 733 key = 'remote.%s.%s' % (self.name, key)
734 return self._config.GetString(key, all_keys = all_keys) 734 return self._config.GetString(key, all_keys=all_keys)
735 735
736 736
737class Branch(object): 737class Branch(object):
@@ -780,4 +780,4 @@ class Branch(object):
780 780
781 def _Get(self, key, all_keys=False): 781 def _Get(self, key, all_keys=False):
782 key = 'branch.%s.%s' % (self.name, key) 782 key = 'branch.%s.%s' % (self.name, key)
783 return self._config.GetString(key, all_keys = all_keys) 783 return self._config.GetString(key, all_keys=all_keys)