@@ -707,7 +707,8 @@ def update(self, **kwargs: Any) -> 'Remote':
707
707
return self
708
708
709
709
def _get_fetch_info_from_stderr (self ,proc :'Git.AutoInterrupt' ,
710
- progress :Union [Callable [...,Any ],RemoteProgress ,None ]
710
+ progress :Union [Callable [...,Any ],RemoteProgress ,None ],
711
+ timeout :float = 60.0
711
712
)-> IterableList ['FetchInfo' ]:
712
713
713
714
progress = to_progress_instance (progress )
@@ -724,7 +725,8 @@ def _get_fetch_info_from_stderr(self, proc: 'Git.AutoInterrupt',
724
725
cmds = set (FetchInfo ._flag_map .keys ())
725
726
726
727
progress_handler = progress .new_message_handler ()
727
- handle_process_output (proc ,None ,progress_handler ,finalizer = None ,decode_streams = False )
728
+ handle_process_output (proc ,None ,progress_handler ,finalizer = None ,decode_streams = False ,
729
+ timeout = timeout )
728
730
729
731
stderr_text = progress .error_lines and '\n ' .join (progress .error_lines )or ''
730
732
proc .wait (stderr = stderr_text )
@@ -769,7 +771,8 @@ def _get_fetch_info_from_stderr(self, proc: 'Git.AutoInterrupt',
769
771
return output
770
772
771
773
def _get_push_info (self ,proc :'Git.AutoInterrupt' ,
772
- progress :Union [Callable [...,Any ],RemoteProgress ,None ])-> IterableList [PushInfo ]:
774
+ progress :Union [Callable [...,Any ],RemoteProgress ,None ],
775
+ timeout :float = 60.0 )-> IterableList [PushInfo ]:
773
776
progress = to_progress_instance (progress )
774
777
775
778
# read progress information from stderr
@@ -786,7 +789,8 @@ def stdout_handler(line: str) -> None:
786
789
# If an error happens, additional info is given which we parse below.
787
790
pass
788
791
789
- handle_process_output (proc ,stdout_handler ,progress_handler ,finalizer = None ,decode_streams = False )
792
+ handle_process_output (proc ,stdout_handler ,progress_handler ,finalizer = None ,decode_streams = False ,
793
+ timeout = timeout )
790
794
stderr_text = progress .error_lines and '\n ' .join (progress .error_lines )or ''
791
795
try :
792
796
proc .wait (stderr = stderr_text )
@@ -813,7 +817,8 @@ def _assert_refspec(self) -> None:
813
817
814
818
def fetch (self ,refspec :Union [str ,List [str ],None ]= None ,
815
819
progress :Union [RemoteProgress ,None ,'UpdateProgress' ]= None ,
816
- verbose :bool = True ,** kwargs :Any )-> IterableList [FetchInfo ]:
820
+ verbose :bool = True ,timeout :float = 60.0 ,
821
+ ** kwargs :Any )-> IterableList [FetchInfo ]:
817
822
"""Fetch the latest changes for this remote
818
823
819
824
:param refspec:
@@ -853,13 +858,14 @@ def fetch(self, refspec: Union[str, List[str], None] = None,
853
858
854
859
proc = self .repo .git .fetch (self ,* args ,as_process = True ,with_stdout = False ,
855
860
universal_newlines = True ,v = verbose ,** kwargs )
856
- res = self ._get_fetch_info_from_stderr (proc ,progress )
861
+ res = self ._get_fetch_info_from_stderr (proc ,progress , timeout = timeout )
857
862
if hasattr (self .repo .odb ,'update_cache' ):
858
863
self .repo .odb .update_cache ()
859
864
return res
860
865
861
866
def pull (self ,refspec :Union [str ,List [str ],None ]= None ,
862
867
progress :Union [RemoteProgress ,'UpdateProgress' ,None ]= None ,
868
+ timeout :float = 60.0 ,
863
869
** kwargs :Any )-> IterableList [FetchInfo ]:
864
870
"""Pull changes from the given branch, being the same as a fetch followed
865
871
by a merge of branch with your local branch.
@@ -874,14 +880,14 @@ def pull(self, refspec: Union[str, List[str], None] = None,
874
880
kwargs = add_progress (kwargs ,self .repo .git ,progress )
875
881
proc = self .repo .git .pull (self ,refspec ,with_stdout = False ,as_process = True ,
876
882
universal_newlines = True ,v = True ,** kwargs )
877
- res = self ._get_fetch_info_from_stderr (proc ,progress )
883
+ res = self ._get_fetch_info_from_stderr (proc ,progress , timeout = timeout )
878
884
if hasattr (self .repo .odb ,'update_cache' ):
879
885
self .repo .odb .update_cache ()
880
886
return res
881
887
882
888
def push (self ,refspec :Union [str ,List [str ],None ]= None ,
883
889
progress :Union [RemoteProgress ,'UpdateProgress' ,Callable [...,RemoteProgress ],None ]= None ,
884
- ** kwargs :Any )-> IterableList [PushInfo ]:
890
+ timeout : float = 60.0 , ** kwargs :Any )-> IterableList [PushInfo ]:
885
891
"""Push changes from source branch in refspec to target branch in refspec.
886
892
887
893
:param refspec: see 'fetch' method
@@ -909,7 +915,7 @@ def push(self, refspec: Union[str, List[str], None] = None,
909
915
kwargs = add_progress (kwargs ,self .repo .git ,progress )
910
916
proc = self .repo .git .push (self ,refspec ,porcelain = True ,as_process = True ,
911
917
universal_newlines = True ,** kwargs )
912
- return self ._get_push_info (proc ,progress )
918
+ return self ._get_push_info (proc ,progress , timeout = timeout )
913
919
914
920
@property
915
921
def config_reader (self )-> SectionConstraint [GitConfigParser ]: