diff options
author | Kostis Anagnostopoulos <ankostis@gmail.com> | 2016-09-28 01:47:49 +0200 |
---|---|---|
committer | Kostis Anagnostopoulos <ankostis@gmail.com> | 2016-09-28 03:35:39 +0200 |
commit | cf2335af23fb693549d6c4e72b65f97afddc5f64 (patch) | |
tree | 4198d6dd1dccc7608eccabd90367edb17f2e4b1c /git/exc.py | |
parent | a5db3d3c49ebe559cb80983d7bb855d4adf1b887 (diff) | |
download | gitpython-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.py | 21 |
1 files changed, 9 insertions, 12 deletions
@@ -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): |