diff options
author | Markus Lehtonen <markus.lehtonen@linux.intel.com> | 2012-06-11 02:46:12 -0700 |
---|---|---|
committer | Gerrit Code Review <gerrit2@otctools.jf.intel.com> | 2012-06-11 02:46:12 -0700 |
commit | f54077e3441fc6b124a1ac60d1a4a2dc5737fba6 (patch) | |
tree | 4fcd70fa44f41b565d0b0941e4de1b58e818cf59 | |
parent | 2f5ef6554de34f64f3f6bea14571b9448437dbe5 (diff) | |
parent | 8e1fecab761ce35825199201a0a6c289ca2a5416 (diff) | |
download | git-buildpackage-f54077e3441fc6b124a1ac60d1a4a2dc5737fba6.tar.gz git-buildpackage-f54077e3441fc6b124a1ac60d1a4a2dc5737fba6.tar.bz2 git-buildpackage-f54077e3441fc6b124a1ac60d1a4a2dc5737fba6.zip |
Merge "GitRepository: raised gitRepositoryError instead of passing CommandExecFailed silently" into experimental-rpm
-rw-r--r-- | gbp/git/repository.py | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/gbp/git/repository.py b/gbp/git/repository.py index c9b77db0..4d8ad1f0 100644 --- a/gbp/git/repository.py +++ b/gbp/git/repository.py @@ -155,8 +155,14 @@ class GitRepository(object): @type args: C{list} @param extra_env: extra environment variables to set when running command @type extra_env: C{dict} + @param cwd: directory, where to run command + @type cwd: C{str} """ - GitCommand(command, args, extra_env=extra_env, cwd=self.path)() + try: + GitCommand(command, args, extra_env=extra_env, cwd=self.path)() + except CommandExecFailed, excobj: + raise GitRepositoryError("Error running git %s: %s" % \ + (command, str(excobj))) def _get_git_version(self): """ @@ -546,7 +552,7 @@ class GitRepository(object): try: self._git_command('tag', args.args) - except CommandExecFailed: + except GitRepositoryError: return False return True @@ -1329,7 +1335,11 @@ class GitRepository(object): try: if not os.path.exists(abspath): os.makedirs(abspath) - GitCommand("init", args.args, cwd=abspath)() + try: + GitCommand("init", args.args, cwd=abspath)() + except CommandExecFailed, excobj: + raise GitRepositoryError("Error running git init: %s" % str(excobj)) + if description: with file(os.path.join(abspath, git_dir, "description"), 'w') as f: description += '\n' if description[-1] != '\n' else '' @@ -1381,7 +1391,12 @@ class GitRepository(object): if not os.path.exists(abspath): os.makedirs(abspath) - GitCommand("clone", args.args, cwd=abspath)() + try: + GitCommand("clone", args.args, cwd=abspath)() + except CommandExecFailed, excobj: + raise GitRepositoryError("Error running git clone: %s" % \ + str(excobj)) + if not name: name = remote.rstrip('/').rsplit('/',1)[1] if (mirror or bare): |