diff options
author | Sverre Rabbelier <sverre@rabbelier.nl> | 2008-06-13 19:40:14 +0200 |
---|---|---|
committer | Sverre Rabbelier <sverre@rabbelier.nl> | 2008-06-13 20:39:52 +0200 |
commit | b38020ae17ed9f83af75ce176e96267dcce6ecbd (patch) | |
tree | 7ceae0ed68e8e44d00e863425587d78683434753 | |
parent | 9b63b3bc493a4a44ba1d857c78e4496e40f1d7b8 (diff) | |
download | gitpython-b38020ae17ed9f83af75ce176e96267dcce6ecbd.tar.gz |
Improved the GIT_PYTHON_TRACE=full output format
It now also shows stderr if there was any on it, and only
shows stdout if there was any output. Also added a '->'
between the command and the return value as a visual clue.
-rw-r--r-- | lib/git/cmd.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/git/cmd.py b/lib/git/cmd.py index cf0f066d..1eed1f84 100644 --- a/lib/git/cmd.py +++ b/lib/git/cmd.py @@ -107,6 +107,10 @@ class Git(MethodMissingMixin): status = proc.wait() proc.stdout.close() + if proc.stderr: + stderr_value = proc.stderr.read() + proc.stderr.close() + # Strip off trailing whitespace by default if not with_raw_output: stdout_value = stdout_value.rstrip() @@ -118,7 +122,12 @@ class Git(MethodMissingMixin): % (str(command), status)) if GIT_PYTHON_TRACE == 'full': - print "%s %d: '%s'" % (command, status, stdout_value) + if stderr_value: + print "%s -> %d: '%s' !! '%s'" % (command, status, stdout_value, stderr_value) + elif stdout_value: + print "%s -> %d: '%s'" % (command, status, stdout_value) + else: + print "%s -> %d" % (command, status) # Allow access to the command's status code if with_status: |