|
6 | 6 | """ Module containing all exceptions thrown througout the git package, """
|
7 | 7 |
|
8 | 8 | class InvalidGitRepositoryError(Exception):
|
9 |
| - """ Thrown if the given repository appears to have an invalid format. """ |
| 9 | + """ Thrown if the given repository appears to have an invalid format. """ |
10 | 10 |
|
11 | 11 |
|
12 | 12 | class NoSuchPathError(OSError):
|
13 |
| - """ Thrown if a path could not be access by the system. """ |
| 13 | + """ Thrown if a path could not be access by the system. """ |
14 | 14 |
|
15 | 15 |
|
16 | 16 | class GitCommandError(Exception):
|
17 |
| - """ Thrown if execution of the git command fails with non-zero status code. """ |
18 |
| - def __init__(self, command, status, stderr=None): |
19 |
| - self.stderr = stderr |
20 |
| - self.status = status |
21 |
| - self.command = command |
22 |
| - |
23 |
| - def __str__(self): |
24 |
| - return ("'%s' returned exit status %i: %s" % |
25 |
| - (' '.join(str(i) for i in self.command), self.status, self.stderr)) |
| 17 | + """ Thrown if execution of the git command fails with non-zero status code. """ |
| 18 | + def __init__(self, command, status, stderr=None): |
| 19 | + self.stderr = stderr |
| 20 | + self.status = status |
| 21 | + self.command = command |
| 22 | + |
| 23 | + def __str__(self): |
| 24 | + return ("'%s' returned exit status %i: %s" % |
| 25 | + (' '.join(str(i) for i in self.command), self.status, self.stderr)) |
26 | 26 |
|
27 | 27 |
|
28 | 28 | class CheckoutError( Exception ):
|
29 |
| - """Thrown if a file could not be checked out from the index as it contained |
30 |
| - changes. |
31 |
| -
|
32 |
| - The .failed_files attribute contains a list of relative paths that failed |
33 |
| - to be checked out as they contained changes that did not exist in the index. |
34 |
| -
|
35 |
| - The .failed_reasons attribute contains a string informing about the actual |
36 |
| - cause of the issue. |
37 |
| -
|
38 |
| - The .valid_files attribute contains a list of relative paths to files that |
39 |
| - were checked out successfully and hence match the version stored in the |
40 |
| - index""" |
41 |
| - def __init__(self, message, failed_files, valid_files, failed_reasons): |
42 |
| - Exception.__init__(self, message) |
43 |
| - self.failed_files = failed_files |
44 |
| - self.failed_reasons = failed_reasons |
45 |
| - self.valid_files = valid_files |
46 |
| - |
47 |
| - def __str__(self): |
48 |
| - return Exception.__str__(self) + ":%s" % self.failed_files |
| 29 | + """Thrown if a file could not be checked out from the index as it contained |
| 30 | + changes. |
| 31 | +
|
| 32 | + The .failed_files attribute contains a list of relative paths that failed |
| 33 | + to be checked out as they contained changes that did not exist in the index. |
| 34 | +
|
| 35 | + The .failed_reasons attribute contains a string informing about the actual |
| 36 | + cause of the issue. |
| 37 | +
|
| 38 | + The .valid_files attribute contains a list of relative paths to files that |
| 39 | + were checked out successfully and hence match the version stored in the |
| 40 | + index""" |
| 41 | + def __init__(self, message, failed_files, valid_files, failed_reasons): |
| 42 | + Exception.__init__(self, message) |
| 43 | + self.failed_files = failed_files |
| 44 | + self.failed_reasons = failed_reasons |
| 45 | + self.valid_files = valid_files |
| 46 | + |
| 47 | + def __str__(self): |
| 48 | + return Exception.__str__(self) + ":%s" % self.failed_files |
| 49 | + |
| 50 | + |
| 51 | +class CacheError(Exception): |
| 52 | + """Base for all errors related to the git index, which is called cache internally""" |
| 53 | + |
| 54 | +class UnmergedEntriesError(CacheError): |
| 55 | + """Thrown if an operation cannot proceed as there are still unmerged |
| 56 | + entries in the cache""" |
0 commit comments