@@ -708,7 +708,7 @@ def update(self, **kwargs: Any) -> 'Remote':
708708
709709 def _get_fetch_info_from_stderr (self , proc : 'Git.AutoInterrupt' ,
710710 progress : Union [Callable [..., Any ], RemoteProgress , None ],
711- timeout : Union [None , float ] = None ,
711+ kill_after_timeout : Union [None , float ] = None ,
712712 ) -> IterableList ['FetchInfo' ]:
713713
714714 progress = to_progress_instance (progress )
@@ -726,7 +726,7 @@ def _get_fetch_info_from_stderr(self, proc: 'Git.AutoInterrupt',
726726
727727 progress_handler = progress .new_message_handler ()
728728 handle_process_output (proc , None , progress_handler , finalizer = None , decode_streams = False ,
729- timeout = timeout )
729+ kill_after_timeout = kill_after_timeout )
730730
731731 stderr_text = progress .error_lines and '\n ' .join (progress .error_lines ) or ''
732732 proc .wait (stderr = stderr_text )
@@ -772,7 +772,7 @@ def _get_fetch_info_from_stderr(self, proc: 'Git.AutoInterrupt',
772772
773773 def _get_push_info (self , proc : 'Git.AutoInterrupt' ,
774774 progress : Union [Callable [..., Any ], RemoteProgress , None ],
775- timeout : Union [None , float ] = None ) -> IterableList [PushInfo ]:
775+ kill_after_timeout : Union [None , float ] = None ) -> IterableList [PushInfo ]:
776776 progress = to_progress_instance (progress )
777777
778778 # read progress information from stderr
@@ -790,7 +790,7 @@ def stdout_handler(line: str) -> None:
790790 pass
791791
792792 handle_process_output (proc , stdout_handler , progress_handler , finalizer = None , decode_streams = False ,
793- timeout = timeout )
793+ kill_after_timeout = kill_after_timeout )
794794 stderr_text = progress .error_lines and '\n ' .join (progress .error_lines ) or ''
795795 try :
796796 proc .wait (stderr = stderr_text )
@@ -817,7 +817,8 @@ def _assert_refspec(self) -> None:
817817
818818 def fetch (self , refspec : Union [str , List [str ], None ] = None ,
819819 progress : Union [RemoteProgress , None , 'UpdateProgress' ] = None ,
820- verbose : bool = True , timeout : Union [None , float ] = None ,
820+ verbose : bool = True ,
821+ kill_after_timeout : Union [None , float ] = None ,
821822 ** kwargs : Any ) -> IterableList [FetchInfo ]:
822823 """Fetch the latest changes for this remote
823824
@@ -838,6 +839,9 @@ def fetch(self, refspec: Union[str, List[str], None] = None,
838839 for 'refspec' will make use of this facility.
839840 :param progress: See 'push' method
840841 :param verbose: Boolean for verbose output
842+ :param kill_after_timeout:
843+ To specify a timeout in seconds for the git command, after which the process
844+ should be killed. It is set to None by default.
841845 :param kwargs: Additional arguments to be passed to git-fetch
842846 :return:
843847 IterableList(FetchInfo, ...) list of FetchInfo instances providing detailed
@@ -858,20 +862,22 @@ def fetch(self, refspec: Union[str, List[str], None] = None,
858862
859863 proc = self .repo .git .fetch (self , * args , as_process = True , with_stdout = False ,
860864 universal_newlines = True , v = verbose , ** kwargs )
861- res = self ._get_fetch_info_from_stderr (proc , progress , timeout = timeout )
865+ res = self ._get_fetch_info_from_stderr (proc , progress ,
866+ kill_after_timeout = kill_after_timeout )
862867 if hasattr (self .repo .odb , 'update_cache' ):
863868 self .repo .odb .update_cache ()
864869 return res
865870
866871 def pull (self , refspec : Union [str , List [str ], None ] = None ,
867872 progress : Union [RemoteProgress , 'UpdateProgress' , None ] = None ,
868- timeout : Union [None , float ] = None ,
873+ kill_after_timeout : Union [None , float ] = None ,
869874 ** kwargs : Any ) -> IterableList [FetchInfo ]:
870875 """Pull changes from the given branch, being the same as a fetch followed
871876 by a merge of branch with your local branch.
872877
873878 :param refspec: see 'fetch' method
874879 :param progress: see 'push' method
880+ :param kill_after_timeout: see 'fetch' method
875881 :param kwargs: Additional arguments to be passed to git-pull
876882 :return: Please see 'fetch' method """
877883 if refspec is None :
@@ -880,14 +886,16 @@ def pull(self, refspec: Union[str, List[str], None] = None,
880886 kwargs = add_progress (kwargs , self .repo .git , progress )
881887 proc = self .repo .git .pull (self , refspec , with_stdout = False , as_process = True ,
882888 universal_newlines = True , v = True , ** kwargs )
883- res = self ._get_fetch_info_from_stderr (proc , progress , timeout = timeout )
889+ res = self ._get_fetch_info_from_stderr (proc , progress ,
890+ kill_after_timeout = kill_after_timeout )
884891 if hasattr (self .repo .odb , 'update_cache' ):
885892 self .repo .odb .update_cache ()
886893 return res
887894
888895 def push (self , refspec : Union [str , List [str ], None ] = None ,
889896 progress : Union [RemoteProgress , 'UpdateProgress' , Callable [..., RemoteProgress ], None ] = None ,
890- timeout : Union [None , float ] = None , ** kwargs : Any ) -> IterableList [PushInfo ]:
897+ kill_after_timeout : Union [None , float ] = None ,
898+ ** kwargs : Any ) -> IterableList [PushInfo ]:
891899 """Push changes from source branch in refspec to target branch in refspec.
892900
893901 :param refspec: see 'fetch' method
@@ -903,6 +911,9 @@ def push(self, refspec: Union[str, List[str], None] = None,
903911 overrides the ``update()`` function.
904912
905913 :note: No further progress information is returned after push returns.
914+ :param kill_after_timeout:
915+ To specify a timeout in seconds for the git command, after which the process
916+ should be killed. It is set to None by default.
906917 :param kwargs: Additional arguments to be passed to git-push
907918 :return:
908919 list(PushInfo, ...) list of PushInfo instances, each
@@ -914,8 +925,11 @@ def push(self, refspec: Union[str, List[str], None] = None,
914925 be 0."""
915926 kwargs = add_progress (kwargs , self .repo .git , progress )
916927 proc = self .repo .git .push (self , refspec , porcelain = True , as_process = True ,
917- universal_newlines = True , ** kwargs )
918- return self ._get_push_info (proc , progress , timeout = timeout )
928+ universal_newlines = True ,
929+ kill_after_timeout = kill_after_timeout ,
930+ ** kwargs )
931+ return self ._get_push_info (proc , progress ,
932+ kill_after_timeout = kill_after_timeout )
919933
920934 @ property
921935 def config_reader (self ) -> SectionConstraint [GitConfigParser ]:
0 commit comments