本文整理汇总了Python中Helper.current_branch方法的典型用法代码示例。如果您正苦于以下问题:Python Helper.current_branch方法的具体用法?Python Helper.current_branch怎么用?Python Helper.current_branch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Helper
的用法示例。
在下文中一共展示了Helper.current_branch方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_open_pr
# 需要导入模块: import Helper [as 别名]
# 或者: from Helper import current_branch [as 别名]
def get_open_pr(self):
ret = self._cache.get('pr')
if ret is not None:
return ret
branch = str(Helper.current_branch())
prs = self._api.call('list_pr', owner=self._owner, repo=self._repo, data={
'head': branch
})[0]
for pr in prs:
if pr['head']['ref'] == branch:
self._cache['pr'] = pr
return pr
return None
示例2: GithubAPIGateway
# 需要导入模块: import Helper [as 别名]
# 或者: from Helper import current_branch [as 别名]
from GithubAPIGateway import GithubAPIGateway
import Helper
import os
import sys
import argparse
import webbrowser
parser = argparse.ArgumentParser()
parser.add_argument("-o", "--open", action="store_true")
args = parser.parse_args()
api = GithubAPIGateway(token=os.environ['GITHUB_TOKEN'])
owner, repo = Helper.owner_and_repo()
branch = str(Helper.current_branch())
prs = api.call('list_pr', owner=owner, repo=repo, data={
'head': branch
})[0]
url = None
for pr in prs:
if pr['head']['ref'] == branch:
url = pr['html_url']
break
if url is not None:
print url
if args.open:
webbrowser.open(url)
else:
print "No PRs on this branch"
示例3:
# 需要导入模块: import Helper [as 别名]
# 或者: from Helper import current_branch [as 别名]
import Helper
import re
import webbrowser
branch = Helper.current_branch()
match = re.search('^(\d+)\-', branch)
issue = None
if match is not None:
owner, repo = Helper.owner_and_repo()
webbrowser.open('https://github.com/{0}/{1}/issues/{2}'.format(owner, repo, match.group(1)))
else:
print 'No issue number on branch'
示例4: get_builds
# 需要导入模块: import Helper [as 别名]
# 或者: from Helper import current_branch [as 别名]
def get_builds(self):
branch = Helper.current_branch()
return self._api.call('recent_branch_builds', username=self._username, project=self._project, branch=branch)[0]