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

Commit48f5476

Browse files
committed
GitRunCommand exception can store stdout output too.
Some git commands, like git merge outputs their problems onto stdout,instead of stderr, which will be thrown away by the current setup. Thischange allows the GitPython commands to store the stdout's value too,in case of error.
1 parent27c577d commit48f5476

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

‎git/cmd.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,10 @@ def execute(self, command,
380380
# END handle debug printing
381381

382382
ifwith_exceptionsandstatus!=0:
383-
raiseGitCommandError(command,status,stderr_value)
383+
ifwith_extended_output:
384+
raiseGitCommandError(command,status,stderr_value,stdout_value)
385+
else:
386+
raiseGitCommandError(command,status,stderr_value)
384387

385388
# Allow access to the command's status code
386389
ifwith_extended_output:

‎git/exc.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,18 @@ class NoSuchPathError(OSError):
1717

1818
classGitCommandError(Exception):
1919
""" Thrown if execution of the git command fails with non-zero status code. """
20-
def__init__(self,command,status,stderr=None):
20+
def__init__(self,command,status,stderr=None,stdout=None):
2121
self.stderr=stderr
22+
self.stdout=stdout
2223
self.status=status
2324
self.command=command
2425

2526
def__str__(self):
26-
return ("'%s' returned exit status %i: %s"%
27-
(' '.join(str(i)foriinself.command),self.status,self.stderr))
27+
ret="'%s' returned exit status %i: %s"% \
28+
(' '.join(str(i)foriinself.command),self.status,self.stderr)
29+
ifself.stdoutisnotNone:
30+
ret+="\nstdout: %s"%self.stdout
31+
returnret
2832

2933

3034
classCheckoutError(Exception ):

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp