@@ -823,27 +823,30 @@ def _call_process(self, method, *args, **kwargs):
823
823
is realized as non-existent
824
824
825
825
: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
+
831
834
git.rev_list('master', max_count=10, header=True)
835
+
836
+ turns into::
837
+
838
+ git rev-list max-count 10 --header master
832
839
833
840
:return: Same as ``execute``"""
834
841
# Handle optional arguments prior to calling transform_kwargs
835
842
# 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 )
842
845
843
- insert_after_this_arg = kwargs .pop ('insert_kwargs_after' , None )
846
+ insert_after_this_arg = opts_kwargs .pop ('insert_kwargs_after' , None )
844
847
845
848
# Prepare the argument list
846
- opt_args = self .transform_kwargs (** kwargs )
849
+ opt_args = self .transform_kwargs (** opts_kwargs )
847
850
ext_args = self .__unpack_args ([a for a in args if a is not None ])
848
851
849
852
if insert_after_this_arg is None :
@@ -852,11 +855,11 @@ def _call_process(self, method, *args, **kwargs):
852
855
try :
853
856
index = ext_args .index (insert_after_this_arg )
854
857
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"
856
859
% (insert_after_this_arg , str (ext_args )))
857
860
# end handle error
858
861
args = ext_args [:index + 1 ] + opt_args + ext_args [index + 1 :]
859
- # end handle kwargs
862
+ # end handle opts_kwargs
860
863
861
864
call = [self .GIT_PYTHON_GIT_EXECUTABLE ]
862
865
@@ -871,7 +874,7 @@ def _call_process(self, method, *args, **kwargs):
871
874
call .append (dashify (method ))
872
875
call .extend (args )
873
876
874
- return self .execute (call , ** _kwargs )
877
+ return self .execute (call , ** exec_kwargs )
875
878
876
879
def _parse_object_header (self , header_line ):
877
880
"""
0 commit comments