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

Commit515a6b9

Browse files
committed
fix(remote): use universal_newlines for fetch/push
That way, real-time parsing of output should finally be possible.Related togitpython-developers#444
1 parent04ff96d commit515a6b9

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

‎git/cmd.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@
4444

4545
execute_kwargs= ('istream','with_keep_cwd','with_extended_output',
4646
'with_exceptions','as_process','stdout_as_string',
47-
'output_stream','with_stdout','kill_after_timeout')
47+
'output_stream','with_stdout','kill_after_timeout',
48+
'universal_newlines')
4849

4950
log=logging.getLogger('git.cmd')
5051
log.addHandler(logging.NullHandler())
@@ -487,6 +488,7 @@ def execute(self, command,
487488
stdout_as_string=True,
488489
kill_after_timeout=None,
489490
with_stdout=True,
491+
universal_newlines=False,
490492
**subprocess_kwargs
491493
):
492494
"""Handles executing the command on the shell and consumes and returns
@@ -541,7 +543,9 @@ def execute(self, command,
541543
specify may not be the same ones.
542544
543545
:param with_stdout: If True, default True, we open stdout on the created process
544-
546+
:param universal_newlines:
547+
if True, pipes will be opened as text, and lines are split at
548+
all known line endings.
545549
:param kill_after_timeout:
546550
To specify a timeout in seconds for the git command, after which the process
547551
should be killed. This will have no effect if as_process is set to True. It is
@@ -608,6 +612,7 @@ def execute(self, command,
608612
stdout=with_stdoutandPIPEoropen(os.devnull,'wb'),
609613
shell=self.USE_SHELL,
610614
close_fds=(os.name=='posix'),# unsupported on windows
615+
universal_newlines=universal_newlines,
611616
**subprocess_kwargs
612617
)
613618
exceptcmd_not_found_exceptionaserr:

‎git/remote.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -663,8 +663,8 @@ def fetch(self, refspec=None, progress=None, **kwargs):
663663
else:
664664
args= [refspec]
665665

666-
proc=self.repo.git.fetch(self,*args,as_process=True,with_stdout=False,v=True,
667-
**kwargs)
666+
proc=self.repo.git.fetch(self,*args,as_process=True,with_stdout=False,
667+
universal_newlines=True,v=True,**kwargs)
668668
res=self._get_fetch_info_from_stderr(proc,progressorRemoteProgress())
669669
ifhasattr(self.repo.odb,'update_cache'):
670670
self.repo.odb.update_cache()
@@ -682,7 +682,8 @@ def pull(self, refspec=None, progress=None, **kwargs):
682682
# No argument refspec, then ensure the repo's config has a fetch refspec.
683683
self._assert_refspec()
684684
kwargs=add_progress(kwargs,self.repo.git,progress)
685-
proc=self.repo.git.pull(self,refspec,with_stdout=False,as_process=True,v=True,**kwargs)
685+
proc=self.repo.git.pull(self,refspec,with_stdout=False,as_process=True,
686+
universal_newlines=True,v=True,**kwargs)
686687
res=self._get_fetch_info_from_stderr(proc,progressorRemoteProgress())
687688
ifhasattr(self.repo.odb,'update_cache'):
688689
self.repo.odb.update_cache()
@@ -707,7 +708,8 @@ def push(self, refspec=None, progress=None, **kwargs):
707708
If the operation fails completely, the length of the returned IterableList will
708709
be null."""
709710
kwargs=add_progress(kwargs,self.repo.git,progress)
710-
proc=self.repo.git.push(self,refspec,porcelain=True,as_process=True,**kwargs)
711+
proc=self.repo.git.push(self,refspec,porcelain=True,as_process=True,
712+
universal_newlines=True,**kwargs)
711713
returnself._get_push_info(proc,progressorRemoteProgress())
712714

713715
@property

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp