def _create_pull_request_helper(repo, remote_repo, branch, base, auth=None):
"""
Creates a pull request to merge the branch into the base.
Ignores the error if there is already a pull request open
for the given branch->base
:param Repo repo:
:param Repository remote_repo:
:param unicode branch:
:param unicode base:
"""
title, message = construct_message(repo, base, branch)
try:
_LOG.info('Creating pull request')
return remote_repo.create_pull(title=title, head=branch, base=base,
body='Autogenerated: \n\n{0}'.format(message))
except GithubException as exc:
if 'errors' in exc.data and len(exc.data['errors']) == 1 and \
exc.data['errors'][0].get('message', '').startswith('A pull request already exists for'):
_LOG.warning('A pull request already exists for "{0}". Continuing.'.format(branch))
return _get_pull_request(remote_repo, branch, base)
else:
raise exc
pullrequest.py 文件源码
python
阅读 24
收藏 0
点赞 0
评论 0
评论列表
文章目录