From 9fbae711b76a4f2fa9345f43da6d2cdedd75d6c3 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Tue, 20 Jan 2015 20:56:33 +0100 Subject: 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. --- git/exc.py | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'git/exc.py') 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) -- cgit v1.2.1