@@ -823,27 +823,30 @@ def _call_process(self, method, *args, **kwargs):
823823 is realized as non-existent
824824
825825 :param kwargs:
826- is a dict of keyword arguments.
827- This function accepts the same optional keyword arguments
828- as execute().
829-
830- ``Examples``::
826+ It contains key-values for the following:
827+ - the :meth:`execute()` kwds, as listed in :var:`execute_kwargs`;
828+ - "command options" to be converted by :meth:`transform_kwargs()`;
829+ - the `'insert_kwargs_after'` key which its value must match one of ``*args``,
830+ and any cmd-options will be appended after the matched arg.
831+
832+ Examples::
833+
831834 git.rev_list('master', max_count=10, header=True)
835+
836+ turns into::
837+
838+ git rev-list max-count 10 --header master
832839
833840 :return: Same as ``execute``"""
834841 # Handle optional arguments prior to calling transform_kwargs
835842 # otherwise these'll end up in args, which is bad.
836- _kwargs = dict ()
837- for kwarg in execute_kwargs :
838- try :
839- _kwargs [kwarg ] = kwargs .pop (kwarg )
840- except KeyError :
841- pass
843+ exec_kwargs = dict ((k , v ) for k , v in kwargs .items () if k in execute_kwargs )
844+ opts_kwargs = dict ((k , v ) for k , v in kwargs .items () if k not in execute_kwargs )
842845
843- insert_after_this_arg = kwargs .pop ('insert_kwargs_after' , None )
846+ insert_after_this_arg = opts_kwargs .pop ('insert_kwargs_after' , None )
844847
845848 # Prepare the argument list
846- opt_args = self .transform_kwargs (** kwargs )
849+ opt_args = self .transform_kwargs (** opts_kwargs )
847850 ext_args = self .__unpack_args ([a for a in args if a is not None ])
848851
849852 if insert_after_this_arg is None :
@@ -852,11 +855,11 @@ def _call_process(self, method, *args, **kwargs):
852855 try :
853856 index = ext_args .index (insert_after_this_arg )
854857 except ValueError :
855- raise ValueError ("Couldn't find argument '%s' in args %s to insert kwargs after"
858+ raise ValueError ("Couldn't find argument '%s' in args %s to insert cmd options after"
856859 % (insert_after_this_arg , str (ext_args )))
857860 # end handle error
858861 args = ext_args [:index + 1 ] + opt_args + ext_args [index + 1 :]
859- # end handle kwargs
862+ # end handle opts_kwargs
860863
861864 call = [self .GIT_PYTHON_GIT_EXECUTABLE ]
862865
@@ -871,7 +874,7 @@ def _call_process(self, method, *args, **kwargs):
871874 call .append (dashify (method ))
872875 call .extend (args )
873876
874- return self .execute (call , ** _kwargs )
877+ return self .execute (call , ** exec_kwargs )
875878
876879 def _parse_object_header (self , header_line ):
877880 """
0 commit comments