def get_remote_branch_name(self, project, local_branch, remote):
# check if there is upstream for local branch
tracking_branch = self.repo.branches[local_branch].tracking_branch()
if tracking_branch:
remote_branch = tracking_branch.name.partition('/')[2]
else:
remote_branch = local_branch
try:
project.branches.get(remote_branch)
except GitlabGetError:
err('Branch [%s] from project [%s] not found',
remote_branch, project.path_with_namespace)
except GitlabConnectionError as e:
err('%s', e)
return remote_branch
评论列表
文章目录