Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf6897c7

Browse files
committed
Added additional opcodes to remote progress to make it compatible to newer git versions. This bug existed for quite a while but didn't show up as progress wasn't sent most of the time. All methods that could use a progress will only activate it if a progress is actually given
1 parentba825ea commitf6897c7

File tree

3 files changed

+26
-16
lines changed

3 files changed

+26
-16
lines changed

‎git/db/cmd/base.py

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -141,14 +141,17 @@ def get_push_info(repo, remotename_or_url, proc, progress):
141141
finalize_process(proc)
142142
returnoutput
143143

144-
defadd_progress(kwargs,git):
144+
defadd_progress(kwargs,git,progress):
145145
"""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
147148
:return: possibly altered kwargs"""
148-
v=git.version_info
149-
ifv[0]>1orv[1]>7orv[2]>0orv[3]>3:
150-
kwargs['progress']=True
151-
#END handle --progress
149+
ifprogress._progressisnotNone:
150+
v=git.version_info
151+
ifv[0]>1orv[1]>7orv[2]>0orv[3]>3:
152+
kwargs['progress']=True
153+
#END handle --progress
154+
#END handle progress
152155
returnkwargs
153156

154157
#} END utilities
@@ -218,6 +221,10 @@ def _parse_progress_line(self, line):
218221
op_code|=self.COMPRESSING
219222
elifop_name=="Writing objects":
220223
op_code|=self.WRITING
224+
elifop_name=="Receiving objects":
225+
op_code|=self.RECEIVING
226+
elifop_name=="Resolving deltas":
227+
op_code|=self.RESOLVING
221228
else:
222229
raiseValueError("Operation name %r unknown"%op_name)
223230

@@ -527,8 +534,9 @@ def push(self, url, refspecs=None, progress=None, **kwargs):
527534
:param refspecs: single string, RefSpec instance or list of such or None.
528535
:param progress: RemoteProgress derived instance or None
529536
: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-
returnget_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+
returnget_push_info(self,url,proc,progress)
532540

533541
defpull(self,url,refspecs=None,progress=None,**kwargs):
534542
"""Fetch and merge the given refspecs.
@@ -537,16 +545,18 @@ def pull(self, url, refspecs=None, progress=None, **kwargs):
537545
:param url: may be a remote name or a url
538546
:param refspecs: see push()
539547
: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-
returnget_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+
returnget_fetch_info_from_stderr(self,proc,progress)
542551

543552
deffetch(self,url,refspecs=None,progress=None,**kwargs):
544553
"""Fetch the latest changes
545554
:param url: may be a remote name or a url
546555
:param refspecs: see push()
547556
: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-
returnget_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+
returnget_fetch_info_from_stderr(self,proc,progress)
550560

551561
#} end transport db interface
552562

@@ -750,7 +760,7 @@ def _clone(cls, git, url, path, progress, **kwargs):
750760
# END windows handling
751761

752762
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))
754764
ifprogressisnotNone:
755765
digest_process_messages(proc.stderr,progress)
756766
#END digest progress messages

‎git/db/interface.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,8 +245,8 @@ class RemoteProgress(object):
245245
246246
Subclasses should derive from this type.
247247
"""
248-
_num_op_codes=5
249-
BEGIN,END,COUNTING,COMPRESSING,WRITING= [1<<xforxinrange(_num_op_codes)]
248+
_num_op_codes=7
249+
BEGIN,END,COUNTING,COMPRESSING,WRITING,RECEIVING,RESOLVING= [1<<xforxinrange(_num_op_codes)]
250250
STAGE_MASK=BEGIN|END
251251
OP_MASK=~STAGE_MASK
252252

‎git/test/objects/test_submodule.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
classTestRootProgress(RootUpdateProgress):
1616
"""Just prints messages, for now without checking the correctness of the states"""
1717

18-
defupdate(self,op,index,max_count,message=''):
18+
defupdate(self,op,index,max_count,message='',input=''):
1919
printmessage
2020

2121
prog=TestRootProgress()

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp