summaryrefslogtreecommitdiff
path: root/git/exc.py
diff options
context:
space:
mode:
authorSebastian Thiel <byronimo@gmail.com>2015-01-20 20:56:33 +0100
committerSebastian Thiel <byronimo@gmail.com>2015-01-20 20:56:33 +0100
commit9fbae711b76a4f2fa9345f43da6d2cdedd75d6c3 (patch)
treee203a3ea4ab21dc4db72e7df3ec52237e7cd65ae /git/exc.py
parentea29541e213df928d356b3c12d4d074001395d3c (diff)
downloadgitpython-9fbae711b76a4f2fa9345f43da6d2cdedd75d6c3.tar.gz
Greatly improved possible safety of Submodule.update(), which is used by default.
Previously, the implementation would gladly reset new commits in submodules, and/or reset a dirty working tree. Now the new force_reset/force flag has to be specified explicitly to get back to the old behaviour. All submodule tests except for one are working.
Diffstat (limited to 'git/exc.py')
-rw-r--r--git/exc.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/git/exc.py b/git/exc.py
index d9b7cbd2..7ee6726e 100644
--- a/git/exc.py
+++ b/git/exc.py
@@ -84,3 +84,14 @@ class HookExecutionError(Exception):
def __str__(self):
return ("'%s' hook returned with exit code %i\nstdout: '%s'\nstderr: '%s'"
% (self.command, self.status, self.stdout, self.stderr))
+
+
+class RepositoryDirtyError(Exception):
+ """Thrown whenever an operation on a repository fails as it has uncommited changes that would be overwritten"""
+
+ def __init__(self, repo, message):
+ self.repo = repo
+ self.message = message
+
+ def __str__(self):
+ return "Operation cannot be performed on %r: %s" % (self.repo, self.message)