summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>2013-03-25 15:57:24 +0200
committerMarkus Lehtonen <markus.lehtonen@linux.intel.com>2013-03-26 18:18:01 +0200
commitf9d0ca5c09f1001c42ebbcb9b41f2189c341fd17 (patch)
tree4c35d4c8fa5f5eb7d1165a47c723b1fe5b4f4e84
parent0299c3747bd1235b9ad28454177368e9fbf0c17b (diff)
downloadgit-buildpackage-f9d0ca5c09f1001c42ebbcb9b41f2189c341fd17.tar.gz
git-buildpackage-f9d0ca5c09f1001c42ebbcb9b41f2189c341fd17.tar.bz2
git-buildpackage-f9d0ca5c09f1001c42ebbcb9b41f2189c341fd17.zip
GitRepository: raise GitRepositoryError instead of GbpError
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
-rw-r--r--gbp/git/repository.py12
-rw-r--r--gbp/scripts/import_orig.py2
-rw-r--r--tests/09_test_write_tree.py2
3 files changed, 8 insertions, 8 deletions
diff --git a/gbp/git/repository.py b/gbp/git/repository.py
index 06900cc6..77c7cf7a 100644
--- a/gbp/git/repository.py
+++ b/gbp/git/repository.py
@@ -23,7 +23,6 @@ from collections import defaultdict
import gbp.log as log
from gbp.command_wrappers import (GitCommand, CommandExecFailed)
-from gbp.errors import GbpError
from gbp.git.modifier import GitModifier
from gbp.git.commit import GitCommit
from gbp.git.errors import GitError
@@ -730,7 +729,7 @@ class GitRepository(object):
args.args,
extra_env={'LC_ALL': 'C'})
if ret:
- raise GbpError("Can't get repository status")
+ raise GitRepositoryError("Can't get repository status")
ret = False
for line in out:
if line.startswith('#'):
@@ -757,7 +756,7 @@ class GitRepository(object):
out, err, ret = self._git_inout('status', options.args,
extra_env={'LC_ALL': 'C'})
if ret:
- raise GbpError("Can't get repository status: %s" % err)
+ raise GitRepositoryError("Can't get repository status: %s" % err)
elements = out.split('\x00')
result = defaultdict(list)
@@ -1197,7 +1196,8 @@ class GitRepository(object):
if not ret:
return self.strip_sha1(sha1)
else:
- raise GbpError("Failed to hash %s: %s" % (filename, stderr))
+ raise GitRepositoryError("Failed to hash %s: %s" % (filename,
+ stderr))
#}
#{ Comitting
@@ -1306,7 +1306,7 @@ class GitRepository(object):
commit = self.commit_tree(tree=tree, msg=msg, parents=parents,
author=author, committer=committer)
if not commit:
- raise GbpError("Failed to commit tree")
+ raise GitRepositoryError("Failed to commit tree")
self.update_ref("refs/heads/%s" % branch, commit, cur)
return commit
@@ -1341,7 +1341,7 @@ class GitRepository(object):
if not ret:
return self.strip_sha1(sha1)
else:
- raise GbpError("Failed to commit tree: %s" % stderr)
+ raise GitRepositoryError("Failed to commit tree: %s" % stderr)
#{ Commit Information
diff --git a/gbp/scripts/import_orig.py b/gbp/scripts/import_orig.py
index ee9f9ef6..3ecce627 100644
--- a/gbp/scripts/import_orig.py
+++ b/gbp/scripts/import_orig.py
@@ -384,7 +384,7 @@ def main(argv):
repo.force_head(current_branch, hard=True)
except (gbpc.CommandExecFailed, GitRepositoryError):
raise GbpError("Import of %s failed" % source.path)
- except GbpError as err:
+ except (GbpError, GitRepositoryError) as err:
if len(err.__str__()):
gbp.log.err(err)
ret = 1
diff --git a/tests/09_test_write_tree.py b/tests/09_test_write_tree.py
index 4275cac7..c6b35e8d 100644
--- a/tests/09_test_write_tree.py
+++ b/tests/09_test_write_tree.py
@@ -60,7 +60,7 @@ class TestWriteTree(testutils.DebianGitTestRepo):
# commit the same tree again using the previous commit as parent
self.repo.commit_tree(sha1, "second commit", parents=[commit])
# commit the same tree again using a non existant parent
- self.assertRaises(gbp.errors.GbpError,
+ self.assertRaises(gbp.git.GitRepositoryError,
self.repo.commit_tree,
sha1,
"failed commit",