rules.py 文件源码

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

项目:open-project-linter 作者: OpenNewsLabs 项目源码 文件源码
def check_multiple_branches(repository):
    """Check whether a git repository has more than one branch.

    Parameters
    ----------
    repository : string
        Path to a git repository

    Results
    -------
    boolean
        True if the repository has more than 1 branch, False otherwise

    Raises
    ------
    git.InvalidGitRepositoryError if repository is a path to a directory
        but not a git repository
    git.NoSuchPathError if repository is not a path to a directory
    """
    repo = git.Repo(repository)
    branches = repo.branches
    if len(branches) > 1:
        return True
    else:
        return False
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号