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

Commit78f3f38

Browse files
committed
Return stderr lines from a pull() call that fails
1 parent5077fc7 commit78f3f38

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

‎git/remote.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -646,6 +646,10 @@ def stdout_handler(line):
646646

647647
try:
648648
handle_process_output(proc,stdout_handler,progress_handler,finalize_process)
649+
exceptGitCommandErroraserr:
650+
# convert any error from wait() into the same error with stdout lines
651+
raiseGitCommandError(err.command,err.status,progress.get_stderr() )
652+
649653
exceptException:
650654
iflen(output)==0:
651655
raise

‎git/util.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,13 +173,17 @@ class RemoteProgress(object):
173173
DONE_TOKEN='done.'
174174
TOKEN_SEPARATOR=', '
175175

176-
__slots__= ("_cur_line","_seen_ops")
176+
__slots__= ("_cur_line","_seen_ops","_error_lines")
177177
re_op_absolute=re.compile(r"(remote: )?([\w\s]+):\s+()(\d+)()(.*)")
178178
re_op_relative=re.compile(r"(remote: )?([\w\s]+):\s+(\d+)% \((\d+)/(\d+)\)(.*)")
179179

180180
def__init__(self):
181181
self._seen_ops=list()
182182
self._cur_line=None
183+
self._error_lines= []
184+
185+
defget_stderr(self):
186+
return'\n'.join(self._error_lines)
183187

184188
def_parse_progress_line(self,line):
185189
"""Parse progress information from the given line as retrieved by git-push
@@ -190,6 +194,10 @@ def _parse_progress_line(self, line):
190194
# Counting objects: 4, done.
191195
# Compressing objects: 50% (1/2) \rCompressing objects: 100% (2/2) \rCompressing objects: 100% (2/2), done.
192196
self._cur_line=line
197+
iflen(self._error_lines)>0orself._cur_line.startswith( ('error:','fatal:') ):
198+
self._error_lines.append(self._cur_line )
199+
return []
200+
193201
sub_lines=line.split('\r')
194202
failed_lines=list()
195203
forslineinsub_lines:

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp