diff options
| -rw-r--r-- | project.py | 17 |
1 files changed, 14 insertions, 3 deletions
| @@ -2146,7 +2146,9 @@ class Project(object): | |||
| 2146 | 2146 | ||
| 2147 | Since we don't have a 'rev_parse' method defined, the __getattr__ will | 2147 | Since we don't have a 'rev_parse' method defined, the __getattr__ will |
| 2148 | run. We'll replace the '_' with a '-' and try to run a git command. | 2148 | run. We'll replace the '_' with a '-' and try to run a git command. |
| 2149 | Any other arguments will be passed to the git command. | 2149 | Any other positional arguments will be passed to the git command, and the |
| 2150 | following keyword arguments are supported: | ||
| 2151 | config: An optional dict of git config options to be passed with '-c'. | ||
| 2150 | 2152 | ||
| 2151 | Args: | 2153 | Args: |
| 2152 | name: The name of the git command to call. Any '_' characters will | 2154 | name: The name of the git command to call. Any '_' characters will |
| @@ -2156,8 +2158,17 @@ class Project(object): | |||
| 2156 | A callable object that will try to call git with the named command. | 2158 | A callable object that will try to call git with the named command. |
| 2157 | """ | 2159 | """ |
| 2158 | name = name.replace('_', '-') | 2160 | name = name.replace('_', '-') |
| 2159 | def runner(*args): | 2161 | def runner(*args, **kwargs): |
| 2160 | cmdv = [name] | 2162 | cmdv = [] |
| 2163 | config = kwargs.pop('config', None) | ||
| 2164 | for k in kwargs: | ||
| 2165 | raise TypeError('%s() got an unexpected keyword argument %r' | ||
| 2166 | % (name, k)) | ||
| 2167 | if config is not None: | ||
| 2168 | for k, v in config.iteritems(): | ||
| 2169 | cmdv.append('-c') | ||
| 2170 | cmdv.append('%s=%s' % (k, v)) | ||
| 2171 | cmdv.append(name) | ||
| 2161 | cmdv.extend(args) | 2172 | cmdv.extend(args) |
| 2162 | p = GitCommand(self._project, | 2173 | p = GitCommand(self._project, |
| 2163 | cmdv, | 2174 | cmdv, |
