summaryrefslogtreecommitdiff
path: root/gbp/git
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2013-07-04 17:18:29 +0200
committerGuido Günther <agx@sigxcpu.org>2013-07-04 17:51:59 +0200
commitb8e921e6c662c75ab382179cd18c0254575aa34b (patch)
tree3db7e2007ce04a96eb3d12a5a6391b19a0755e99 /gbp/git
parentb615db5ef00fa8ba627cbdabf3abfd9bf21fc5c4 (diff)
GitRepository.set_upstream_branch: use --set-upstream-to if available
since --set-upstream is deprecated.
Diffstat (limited to 'gbp/git')
-rw-r--r--gbp/git/repository.py9
1 files changed, 6 insertions, 3 deletions
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(