From b8e921e6c662c75ab382179cd18c0254575aa34b Mon Sep 17 00:00:00 2001 From: Guido Günther Date: Thu, 4 Jul 2013 17:18:29 +0200 Subject: GitRepository.set_upstream_branch: use --set-upstream-to if available since --set-upstream is deprecated. --- gbp/git/repository.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'gbp/git') diff --git a/gbp/git/repository.py b/gbp/git/repository.py index 0396367..502a391 100644 --- a/gbp/git/repository.py +++ b/gbp/git/repository.py @@ -538,10 +538,13 @@ class GitRepository(object): if not self.has_branch(branch, remote=remote): raise GitRepositoryError("Branch %s doesn't exist!" % branch) + if self._cmd_has_feature('branch', 'set-upstream-to'): + args = ['--set-upstream-to=%s' % upstream, local_branch] + else: + args = ["--set-upstream", local_branch, upstream] + dummy, err, ret = self._git_inout('branch', - ['--set-upstream', - local_branch, - upstream], + args, capture_stderr=True) if ret: raise GitRepositoryError( -- cgit v1.2.3