@@ -141,6 +141,16 @@ def get_push_info(repo, remotename_or_url, proc, progress):
141
141
finalize_process (proc )
142
142
return output
143
143
144
+ def add_progress (kwargs , git ):
145
+ """Add the --progress flag to the given kwargs dict if supported by the
146
+ git command
147
+ :return: possibly altered kwargs"""
148
+ v = git .version_info
149
+ if v [0 ] > 1 or v [1 ] > 7 or v [2 ] > 0 or v [3 ] > 3 :
150
+ kwargs ['progress' ] = True
151
+ #END handle --progress
152
+ return kwargs
153
+
144
154
#} END utilities
145
155
146
156
class CmdRemoteProgress (RemoteProgress ):
@@ -517,7 +527,7 @@ def push(self, url, refspecs=None, progress=None, **kwargs):
517
527
:param refspecs: single string, RefSpec instance or list of such or None.
518
528
:param progress: RemoteProgress derived instance or None
519
529
:param **kwargs: Additional arguments to be passed to the git-push process"""
520
- proc = self ._git .push (url , refspecs , porcelain = True , as_process = True , ** kwargs )
530
+ proc = self ._git .push (url , refspecs , porcelain = True , as_process = True , ** add_progress ( kwargs , self . git ) )
521
531
return get_push_info (self , url , proc , CmdRemoteProgress (progress ))
522
532
523
533
def pull (self , url , refspecs = None , progress = None , ** kwargs ):
@@ -527,15 +537,15 @@ def pull(self, url, refspecs=None, progress=None, **kwargs):
527
537
:param url: may be a remote name or a url
528
538
:param refspecs: see push()
529
539
:param progress: see push()"""
530
- proc = self ._git .pull (url , refspecs , with_extended_output = True , as_process = True , v = True , ** kwargs )
540
+ proc = self ._git .pull (url , refspecs , with_extended_output = True , as_process = True , v = True , ** add_progress ( kwargs , self . git ) )
531
541
return get_fetch_info_from_stderr (self , proc , CmdRemoteProgress (progress ))
532
542
533
543
def fetch (self , url , refspecs = None , progress = None , ** kwargs ):
534
544
"""Fetch the latest changes
535
545
:param url: may be a remote name or a url
536
546
:param refspecs: see push()
537
547
:param progress: see push()"""
538
- proc = self ._git .fetch (url , refspecs , with_extended_output = True , as_process = True , v = True , ** kwargs )
548
+ proc = self ._git .fetch (url , refspecs , with_extended_output = True , as_process = True , v = True , ** add_progress ( kwargs , self . git ) )
539
549
return get_fetch_info_from_stderr (self , proc , CmdRemoteProgress (progress ))
540
550
541
551
#} end transport db interface
@@ -740,7 +750,7 @@ def _clone(cls, git, url, path, progress, **kwargs):
740
750
# END windows handling
741
751
742
752
try :
743
- proc = git .clone (url , path , with_extended_output = True , as_process = True , v = True , ** kwargs )
753
+ proc = git .clone (url , path , with_extended_output = True , as_process = True , v = True , ** add_progress ( kwargs , git ) )
744
754
if progress is not None :
745
755
digest_process_messages (proc .stderr , progress )
746
756
#END digest progress messages
0 commit comments