@@ -708,7 +708,7 @@ def update(self, **kwargs: Any) -> 'Remote':
708
708
709
709
def _get_fetch_info_from_stderr (self , proc : 'Git.AutoInterrupt' ,
710
710
progress : Union [Callable [..., Any ], RemoteProgress , None ],
711
- timeout : Union [None , float ] = None ,
711
+ kill_after_timeout : Union [None , float ] = None ,
712
712
) -> IterableList ['FetchInfo' ]:
713
713
714
714
progress = to_progress_instance (progress )
@@ -726,7 +726,7 @@ def _get_fetch_info_from_stderr(self, proc: 'Git.AutoInterrupt',
726
726
727
727
progress_handler = progress .new_message_handler ()
728
728
handle_process_output (proc , None , progress_handler , finalizer = None , decode_streams = False ,
729
- timeout = timeout )
729
+ kill_after_timeout = kill_after_timeout )
730
730
731
731
stderr_text = progress .error_lines and '\n ' .join (progress .error_lines ) or ''
732
732
proc .wait (stderr = stderr_text )
@@ -772,7 +772,7 @@ def _get_fetch_info_from_stderr(self, proc: 'Git.AutoInterrupt',
772
772
773
773
def _get_push_info (self , proc : 'Git.AutoInterrupt' ,
774
774
progress : Union [Callable [..., Any ], RemoteProgress , None ],
775
- timeout : Union [None , float ] = None ) -> IterableList [PushInfo ]:
775
+ kill_after_timeout : Union [None , float ] = None ) -> IterableList [PushInfo ]:
776
776
progress = to_progress_instance (progress )
777
777
778
778
# read progress information from stderr
@@ -790,7 +790,7 @@ def stdout_handler(line: str) -> None:
790
790
pass
791
791
792
792
handle_process_output (proc , stdout_handler , progress_handler , finalizer = None , decode_streams = False ,
793
- timeout = timeout )
793
+ kill_after_timeout = kill_after_timeout )
794
794
stderr_text = progress .error_lines and '\n ' .join (progress .error_lines ) or ''
795
795
try :
796
796
proc .wait (stderr = stderr_text )
@@ -817,7 +817,8 @@ def _assert_refspec(self) -> None:
817
817
818
818
def fetch (self , refspec : Union [str , List [str ], None ] = None ,
819
819
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 ,
821
822
** kwargs : Any ) -> IterableList [FetchInfo ]:
822
823
"""Fetch the latest changes for this remote
823
824
@@ -838,6 +839,9 @@ def fetch(self, refspec: Union[str, List[str], None] = None,
838
839
for 'refspec' will make use of this facility.
839
840
:param progress: See 'push' method
840
841
: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.
841
845
:param kwargs: Additional arguments to be passed to git-fetch
842
846
:return:
843
847
IterableList(FetchInfo, ...) list of FetchInfo instances providing detailed
@@ -858,20 +862,22 @@ def fetch(self, refspec: Union[str, List[str], None] = None,
858
862
859
863
proc = self .repo .git .fetch (self , * args , as_process = True , with_stdout = False ,
860
864
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 )
862
867
if hasattr (self .repo .odb , 'update_cache' ):
863
868
self .repo .odb .update_cache ()
864
869
return res
865
870
866
871
def pull (self , refspec : Union [str , List [str ], None ] = None ,
867
872
progress : Union [RemoteProgress , 'UpdateProgress' , None ] = None ,
868
- timeout : Union [None , float ] = None ,
873
+ kill_after_timeout : Union [None , float ] = None ,
869
874
** kwargs : Any ) -> IterableList [FetchInfo ]:
870
875
"""Pull changes from the given branch, being the same as a fetch followed
871
876
by a merge of branch with your local branch.
872
877
873
878
:param refspec: see 'fetch' method
874
879
:param progress: see 'push' method
880
+ :param kill_after_timeout: see 'fetch' method
875
881
:param kwargs: Additional arguments to be passed to git-pull
876
882
:return: Please see 'fetch' method """
877
883
if refspec is None :
@@ -880,14 +886,16 @@ def pull(self, refspec: Union[str, List[str], None] = None,
880
886
kwargs = add_progress (kwargs , self .repo .git , progress )
881
887
proc = self .repo .git .pull (self , refspec , with_stdout = False , as_process = True ,
882
888
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 )
884
891
if hasattr (self .repo .odb , 'update_cache' ):
885
892
self .repo .odb .update_cache ()
886
893
return res
887
894
888
895
def push (self , refspec : Union [str , List [str ], None ] = None ,
889
896
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 ]:
891
899
"""Push changes from source branch in refspec to target branch in refspec.
892
900
893
901
:param refspec: see 'fetch' method
@@ -903,6 +911,9 @@ def push(self, refspec: Union[str, List[str], None] = None,
903
911
overrides the ``update()`` function.
904
912
905
913
: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.
906
917
:param kwargs: Additional arguments to be passed to git-push
907
918
:return:
908
919
list(PushInfo, ...) list of PushInfo instances, each
@@ -914,8 +925,11 @@ def push(self, refspec: Union[str, List[str], None] = None,
914
925
be 0."""
915
926
kwargs = add_progress (kwargs , self .repo .git , progress )
916
927
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 )
919
933
920
934
@ property
921
935
def config_reader (self ) -> SectionConstraint [GitConfigParser ]:
0 commit comments