当前位置: 首页>>代码示例>>Python>>正文


Python Helper.current_branch方法代码示例

本文整理汇总了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
开发者ID:santi-h,项目名称:git-scripts,代码行数:18,代码来源:GithubAPIDriver.py

示例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"
开发者ID:santi-h,项目名称:git-scripts,代码行数:31,代码来源:list_pr.py

示例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'
开发者ID:santi-h,项目名称:git-scripts,代码行数:14,代码来源:open_issue.py

示例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]
开发者ID:santi-h,项目名称:git-scripts,代码行数:5,代码来源:CircleCiAPIDriver.py


注:本文中的Helper.current_branch方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。