diff options
author | Sebastian Thiel <byronimo@gmail.com> | 2015-02-21 10:12:11 +0100 |
---|---|---|
committer | Sebastian Thiel <byronimo@gmail.com> | 2015-02-21 10:14:59 +0100 |
commit | e0acb8371bb2b68c2bda04db7cb2746ba3f9da86 (patch) | |
tree | dad907401197e27fee983e420cc780f48cd6a463 /git/cmd.py | |
parent | bfcdf2bef08f17b4726b67f06c84be3bfe2c39b8 (diff) | |
download | gitpython-e0acb8371bb2b68c2bda04db7cb2746ba3f9da86.tar.gz |
Added 'insert_kwargs_after' flag for consumption by _call_process.
While at it, all other invocations of .git in remote.py were reviewed
Fixes #262
Diffstat (limited to 'git/cmd.py')
-rw-r--r-- | git/cmd.py | 14 |
1 files changed, 13 insertions, 1 deletions
@@ -753,11 +753,23 @@ class Git(LazyMixin): except KeyError: pass + insert_after_this_arg = kwargs.pop('insert_kwargs_after', None) + # Prepare the argument list opt_args = self.transform_kwargs(**kwargs) ext_args = self.__unpack_args([a for a in args if a is not None]) - args = opt_args + ext_args + if insert_after_this_arg is None: + args = opt_args + ext_args + else: + try: + index = ext_args.index(insert_after_this_arg) + except ValueError: + raise ValueError("Couldn't find argument '%s' in args %s to insert kwargs after" + % (insert_after_this_arg, str(ext_args))) + # end handle error + args = ext_args[:index + 1] + opt_args + ext_args[index + 1:] + # end handle kwargs def make_call(): call = [self.GIT_PYTHON_GIT_EXECUTABLE] |