summaryrefslogtreecommitdiff
path: root/gbp/git
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2013-07-04 17:00:02 +0200
committerGuido Günther <agx@sigxcpu.org>2013-07-04 17:51:59 +0200
commitb615db5ef00fa8ba627cbdabf3abfd9bf21fc5c4 (patch)
tree2ecd00c9ce8df665a6a51da398d14e0e6a465be4 /gbp/git
parent7762b17e1583356f9ba7e4484dd474c988dba12c (diff)
GitRepository.set_upstream_branch: Catch errors to set upstream branch
Diffstat (limited to 'gbp/git')
-rw-r--r--gbp/git/repository.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/gbp/git/repository.py b/gbp/git/repository.py
index e172aad..0396367 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):
"""