From: Guido Günther Date: Thu, 4 Jul 2013 15:00:02 +0000 (+0200) Subject: GitRepository.set_upstream_branch: Catch errors to set upstream branch X-Git-Tag: debian/0.6.2~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b615db5ef00fa8ba627cbdabf3abfd9bf21fc5c4;p=tools%2Fgit-buildpackage.git GitRepository.set_upstream_branch: Catch errors to set upstream branch --- diff --git a/gbp/git/repository.py b/gbp/git/repository.py index e172aad6..03963670 100644 --- a/gbp/git/repository.py +++ b/gbp/git/repository.py @@ -538,8 +538,15 @@ class GitRepository(object): if not self.has_branch(branch, remote=remote): raise GitRepositoryError("Branch %s doesn't exist!" % branch) - self._git_inout('branch', ["--set-upstream", local_branch, upstream], - capture_stderr=True) + dummy, err, ret = self._git_inout('branch', + ['--set-upstream', + local_branch, + upstream], + capture_stderr=True) + if ret: + raise GitRepositoryError( + "Failed to set upstream branch '%s' for '%s': %s" % + (upstream, local_branch, err.strip())) def get_upstream_branch(self, local_branch): """