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

Commitfe2fbc5

Browse files
committed
Remote.fetch|pull() will not use poll/threads anymore as only stderr is read.
This simplification should improve performance and remove issues like thoseingitpython-developers#232.NOTE: Debug code is still contained here
1 parent3480201 commitfe2fbc5

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

‎git/remote.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -525,8 +525,10 @@ def _get_fetch_info_from_stderr(self, proc, progress):
525525
progress_handler=progress.new_message_handler()
526526

527527
stderr_fetch=open(join(self.repo.git_dir,'%03i_debug_git-python_stderr'%self.fetch_no),'wb')
528-
defmy_progress_handler(line):
529-
stderr_fetch.write((line+'\n').encode(defenc))
528+
forlineinproc.stderr:
529+
line=line.decode(defenc)
530+
stderr_fetch.write((line).encode(defenc))
531+
line=line.rstrip()
530532
forplineinprogress_handler(line):
531533
ifline.startswith('fatal:'):
532534
raiseGitCommandError(("Error when fetching: %s"%line,),2)
@@ -541,12 +543,13 @@ def my_progress_handler(line):
541543
# end
542544

543545
# We are only interested in stderr here ...
544-
handle_process_output(proc,None,my_progress_handler,finalize_process)
546+
finalize_process(proc)
545547
stderr_fetch.close()
546548

547549
# read head information
548550
importshutil
549-
shutil.copyfile(join(self.repo.git_dir,'FETCH_HEAD'),join(self.repo.git_dir,'%03i_debug_git-python_FETCH_HEAD'%self.fetch_no))
551+
shutil.copyfile(join(self.repo.git_dir,'FETCH_HEAD'),
552+
join(self.repo.git_dir,'%03i_debug_git-python_FETCH_HEAD'%self.fetch_no))
550553
self.fetch_no+=1
551554
fp=open(join(self.repo.git_dir,'FETCH_HEAD'),'rb')
552555
fetch_head_info= [l.decode(defenc)forlinfp.readlines()]
@@ -615,6 +618,7 @@ def fetch(self, refspec=None, progress=None, **kwargs):
615618
args= [refspec]
616619

617620
proc=self.repo.git.fetch(self,*args,with_extended_output=True,as_process=True,v=True,**kwargs)
621+
proc.stdout.close()
618622
res=self._get_fetch_info_from_stderr(proc,progressorRemoteProgress())
619623
ifhasattr(self.repo.odb,'update_cache'):
620624
self.repo.odb.update_cache()
@@ -630,6 +634,7 @@ def pull(self, refspec=None, progress=None, **kwargs):
630634
:return: Please see 'fetch' method """
631635
kwargs=add_progress(kwargs,self.repo.git,progress)
632636
proc=self.repo.git.pull(self,refspec,with_extended_output=True,as_process=True,v=True,**kwargs)
637+
proc.stdout.close()
633638
res=self._get_fetch_info_from_stderr(proc,progressorRemoteProgress())
634639
ifhasattr(self.repo.odb,'update_cache'):
635640
self.repo.odb.update_cache()

‎git/test/test_remote.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,7 @@ def _assert_push_and_pull(self, remote, rw_repo, remote_repo):
348348
new_head=Head.create(rw_repo,"my_new_branch")
349349
progress=TestRemoteProgress()
350350
res=remote.push(new_head,progress)
351+
assertlen(res)>0
351352
assertres[0].flags&PushInfo.NEW_HEAD
352353
progress.make_assertion()
353354
self._do_test_push_result(res,remote)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp