fab_git.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:badge 作者: SavandBros 项目源码 文件源码
def new_branch():
    """
    Creating new branch
    """
    branch_type = slugify((prompt('Branch type:', default='feature')))
    issue_id = prompt("Issue ID:")
    short_description = slugify(prompt('Short description:'))

    if not branch_type or not short_description:
        raise ValueError('[Branch type] and [Short description] are'
                         'mandatory.')

    if issue_id:
        issue_id = '-#{0}'.format(issue_id)

    branch_name = "{0}{1}-{2}".format(branch_type, issue_id, short_description)
    ru_sure = prompt(
        text='Branch name will be "{0}", Are sure? (y/n)'.format(branch_name),
        default='y'
    )

    if ru_sure != 'y':
            return

    _git('checkout -b "{0}"'.format(branch_name))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号