@@ -141,14 +141,17 @@ 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 ):
144
+ def add_progress (kwargs , git , progress ):
145
145
"""Add the --progress flag to the given kwargs dict if supported by the
146
- git command
146
+ git command. If the actual progress in the given progress instance is not
147
+ given, we do not request any progress
147
148
: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
149
+ if progress ._progress is not None :
150
+ v = git .version_info
151
+ if v [0 ] > 1 or v [1 ] > 7 or v [2 ] > 0 or v [3 ] > 3 :
152
+ kwargs ['progress' ] = True
153
+ #END handle --progress
154
+ #END handle progress
152
155
return kwargs
153
156
154
157
#} END utilities
@@ -218,6 +221,10 @@ def _parse_progress_line(self, line):
218
221
op_code |= self .COMPRESSING
219
222
elif op_name == "Writing objects" :
220
223
op_code |= self .WRITING
224
+ elif op_name == "Receiving objects" :
225
+ op_code |= self .RECEIVING
226
+ elif op_name == "Resolving deltas" :
227
+ op_code |= self .RESOLVING
221
228
else :
222
229
raise ValueError ("Operation name %r unknown" % op_name )
223
230
@@ -527,8 +534,9 @@ def push(self, url, refspecs=None, progress=None, **kwargs):
527
534
:param refspecs: single string, RefSpec instance or list of such or None.
528
535
:param progress: RemoteProgress derived instance or None
529
536
:param **kwargs: Additional arguments to be passed to the git-push process"""
530
- proc = self ._git .push (url , refspecs , porcelain = True , as_process = True , ** add_progress (kwargs , self .git ))
531
- return get_push_info (self , url , proc , CmdRemoteProgress (progress ))
537
+ progress = CmdRemoteProgress (progress )
538
+ proc = self ._git .push (url , refspecs , porcelain = True , as_process = True , ** add_progress (kwargs , self .git , progress ))
539
+ return get_push_info (self , url , proc , progress )
532
540
533
541
def pull (self , url , refspecs = None , progress = None , ** kwargs ):
534
542
"""Fetch and merge the given refspecs.
@@ -537,16 +545,18 @@ def pull(self, url, refspecs=None, progress=None, **kwargs):
537
545
:param url: may be a remote name or a url
538
546
:param refspecs: see push()
539
547
:param progress: see push()"""
540
- proc = self ._git .pull (url , refspecs , with_extended_output = True , as_process = True , v = True , ** add_progress (kwargs , self .git ))
541
- return get_fetch_info_from_stderr (self , proc , CmdRemoteProgress (progress ))
548
+ progress = CmdRemoteProgress (progress )
549
+ proc = self ._git .pull (url , refspecs , with_extended_output = True , as_process = True , v = True , ** add_progress (kwargs , self .git , progress ))
550
+ return get_fetch_info_from_stderr (self , proc , progress )
542
551
543
552
def fetch (self , url , refspecs = None , progress = None , ** kwargs ):
544
553
"""Fetch the latest changes
545
554
:param url: may be a remote name or a url
546
555
:param refspecs: see push()
547
556
:param progress: see push()"""
548
- proc = self ._git .fetch (url , refspecs , with_extended_output = True , as_process = True , v = True , ** add_progress (kwargs , self .git ))
549
- return get_fetch_info_from_stderr (self , proc , CmdRemoteProgress (progress ))
557
+ progress = CmdRemoteProgress (progress )
558
+ proc = self ._git .fetch (url , refspecs , with_extended_output = True , as_process = True , v = True , ** add_progress (kwargs , self .git , progress ))
559
+ return get_fetch_info_from_stderr (self , proc , progress )
550
560
551
561
#} end transport db interface
552
562
@@ -750,7 +760,7 @@ def _clone(cls, git, url, path, progress, **kwargs):
750
760
# END windows handling
751
761
752
762
try :
753
- proc = git .clone (url , path , with_extended_output = True , as_process = True , v = True , ** add_progress (kwargs , git ))
763
+ proc = git .clone (url , path , with_extended_output = True , as_process = True , v = True , ** add_progress (kwargs , git , progress ))
754
764
if progress is not None :
755
765
digest_process_messages (proc .stderr , progress )
756
766
#END digest progress messages
0 commit comments