@@ -822,27 +822,30 @@ def _call_process(self, method, *args, **kwargs):
822822            is realized as non-existent 
823823
824824        :param kwargs: 
825-             is a dict of keyword arguments. 
826-             This function accepts the same optional keyword arguments 
827-             as execute(). 
828- 
829-         ``Examples``:: 
825+             It contains key-values for the following: 
826+             - the :meth:`execute()` kwds, as listed in :var:`execute_kwargs`; 
827+             - "command options" to be converted by :meth:`transform_kwargs()`; 
828+             - the `'insert_kwargs_after'` key which its value must match one of ``*args``, 
829+               and any cmd-options will be appended after the matched arg. 
830+          
831+         Examples:: 
832+          
830833            git.rev_list('master', max_count=10, header=True) 
834+          
835+         turns into:: 
836+          
837+            git rev-list max-count 10 --header master 
831838
832839        :return: Same as ``execute``""" 
833840        # Handle optional arguments prior to calling transform_kwargs 
834841        # otherwise these'll end up in args, which is bad. 
835-         _kwargs  =  dict ()
836-         for  kwarg  in  execute_kwargs :
837-             try :
838-                 _kwargs [kwarg ] =  kwargs .pop (kwarg )
839-             except  KeyError :
840-                 pass 
842+         exec_kwargs  =  dict ((k , v ) for  k , v  in  kwargs .items () if  k  in  execute_kwargs )
843+         opts_kwargs  =  dict ((k , v ) for  k , v  in  kwargs .items () if  k  not  in execute_kwargs )
841844
842-         insert_after_this_arg  =  kwargs .pop ('insert_kwargs_after' , None )
845+         insert_after_this_arg  =  opts_kwargs .pop ('insert_kwargs_after' , None )
843846
844847        # Prepare the argument list 
845-         opt_args  =  self .transform_kwargs (** kwargs )
848+         opt_args  =  self .transform_kwargs (** opts_kwargs )
846849        ext_args  =  self .__unpack_args ([a  for  a  in  args  if  a  is  not None ])
847850
848851        if  insert_after_this_arg  is  None :
@@ -851,11 +854,11 @@ def _call_process(self, method, *args, **kwargs):
851854            try :
852855                index  =  ext_args .index (insert_after_this_arg )
853856            except  ValueError :
854-                 raise  ValueError ("Couldn't find argument '%s' in args %s to insert kwargs  after" 
857+                 raise  ValueError ("Couldn't find argument '%s' in args %s to insert cmd options  after" 
855858                                 %  (insert_after_this_arg , str (ext_args )))
856859            # end handle error 
857860            args  =  ext_args [:index  +  1 ] +  opt_args  +  ext_args [index  +  1 :]
858-         # end handle kwargs  
861+         # end handle opts_kwargs  
859862
860863        call  =  [self .GIT_PYTHON_GIT_EXECUTABLE ]
861864
@@ -870,7 +873,7 @@ def _call_process(self, method, *args, **kwargs):
870873        call .append (dashify (method ))
871874        call .extend (args )
872875
873-         return  self .execute (call , ** _kwargs )
876+         return  self .execute (call , ** exec_kwargs )
874877
875878    def  _parse_object_header (self , header_line ):
876879        """ 
0 commit comments