diff options
author | Guido Günther <agx@sigxcpu.org> | 2013-07-04 17:18:29 +0200 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2013-07-04 17:51:59 +0200 |
commit | b8e921e6c662c75ab382179cd18c0254575aa34b (patch) | |
tree | 3db7e2007ce04a96eb3d12a5a6391b19a0755e99 /gbp/git | |
parent | b615db5ef00fa8ba627cbdabf3abfd9bf21fc5c4 (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.py | 9 |
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( |