diff options
author | Guido Günther <agx@sigxcpu.org> | 2013-07-04 17:00:02 +0200 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2013-07-04 17:51:59 +0200 |
commit | b615db5ef00fa8ba627cbdabf3abfd9bf21fc5c4 (patch) | |
tree | 2ecd00c9ce8df665a6a51da398d14e0e6a465be4 | |
parent | 7762b17e1583356f9ba7e4484dd474c988dba12c (diff) | |
download | git-buildpackage-b615db5ef00fa8ba627cbdabf3abfd9bf21fc5c4.tar.gz git-buildpackage-b615db5ef00fa8ba627cbdabf3abfd9bf21fc5c4.tar.bz2 git-buildpackage-b615db5ef00fa8ba627cbdabf3abfd9bf21fc5c4.zip |
GitRepository.set_upstream_branch: Catch errors to set upstream branch
-rw-r--r-- | gbp/git/repository.py | 11 |
1 files changed, 9 insertions, 2 deletions
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): """ |