summaryrefslogtreecommitdiff
path: root/git/exc.py
diff options
context:
space:
mode:
authorKostis Anagnostopoulos <ankostis@gmail.com>2016-09-28 01:47:49 +0200
committerKostis Anagnostopoulos <ankostis@gmail.com>2016-09-28 03:35:39 +0200
commitcf2335af23fb693549d6c4e72b65f97afddc5f64 (patch)
tree4198d6dd1dccc7608eccabd90367edb17f2e4b1c /git/exc.py
parenta5db3d3c49ebe559cb80983d7bb855d4adf1b887 (diff)
downloadgitpython-cf2335af23fb693549d6c4e72b65f97afddc5f64.tar.gz
Win, hook, #519: Consume Hook Popen-proc out of GIL
+ HookException thrown on Popen, and were missed on Windows. + No SHELL on Popen?? + Minor fixes: + Try harder to delete trees - no remorses. + Simplify exception reprs. + Unittest-ize test_index assertions.
Diffstat (limited to 'git/exc.py')
-rw-r--r--git/exc.py21
1 files changed, 9 insertions, 12 deletions
diff --git a/git/exc.py b/git/exc.py
index 3a93c447..37712d11 100644
--- a/git/exc.py
+++ b/git/exc.py
@@ -37,13 +37,9 @@ class GitCommandError(UnicodeMixin, Exception):
self.command = command
def __unicode__(self):
- ret = u"'%s' returned with exit code %s" % \
- (u' '.join(safe_decode(i) for i in self.command), self.status)
- if self.stderr:
- ret += u"\nstderr: '%s'" % safe_decode(self.stderr)
- if self.stdout:
- ret += u"\nstdout: '%s'" % safe_decode(self.stdout)
- return ret
+ cmdline = u' '.join(safe_decode(i) for i in self.command)
+ return (u"'%s' returned with exit code %s\n stdout: '%s'\n stderr: '%s'"
+ % (cmdline, self.status, safe_decode(self.stdout), safe_decode(self.stderr)))
class CheckoutError(Exception):
@@ -80,19 +76,20 @@ class UnmergedEntriesError(CacheError):
entries in the cache"""
-class HookExecutionError(Exception):
+class HookExecutionError(UnicodeMixin, Exception):
"""Thrown if a hook exits with a non-zero exit code. It provides access to the exit code and the string returned
via standard output"""
- def __init__(self, command, status, stdout, stderr):
+ def __init__(self, command, status, stdout=None, stderr=None):
self.command = command
self.status = status
self.stdout = stdout
self.stderr = stderr
- def __str__(self):
- return ("'%s' hook returned with exit code %i\nstdout: '%s'\nstderr: '%s'"
- % (self.command, self.status, self.stdout, self.stderr))
+ def __unicode__(self):
+ cmdline = u' '.join(safe_decode(i) for i in self.command)
+ return (u"'%s' hook failed with %r\n stdout: '%s'\n stderr: '%s'"
+ % (cmdline, self.status, safe_decode(self.stdout), safe_decode(self.stderr)))
class RepositoryDirtyError(Exception):