提供对python中“git subrepo”的访问
gitsubrepo的Python项目详细描述
git subrepo python包装器
以同样的方式 `GitPython<;https://pypi.python.org/pypi/GitPython/>;``包装 git,此库提供对python中git subrepo的简单访问。
如何使用
先决条件
- git>;=2.10.0(路径上)
- Git Subrepo=0.3.1
- python=3.6
安装
稳定版本可以通过 PyPI:
$ pip install gitsubrepo
出血边缘版本可以直接从github安装:
$ pip install git+https://github.com/wtsi-hgi/python-git-subrepo.git@${commitIdBranchOrTag}#egg=gitsubrepo
若要将此库声明为项目的依赖项,请将其添加到 requirement.txt文件。
API
库当前支持3git subrepo操作:clone, pull和status。具体见文件 关于如何使用这些方法的信息。
示例用法:
importgitsubreporemote_repository="https://github.com/colin-nolan/test-repository.git"repository_location="/tmp/repo"subrepo_location=f"{repository_location}/subrepo"branch="develop"commit_reference=gitsubrepo.clone(remote_repository,subrepo_location,branch=branch)updated_commit_reference=gitsubrepo.pull(subrepo_location)subrepo_remote,subrepo_branch,subrepo_commit=gitsubrepo.status(subrepo_location)assertsubrepo_remote==remote_repositoryassertsubrepo_branch==branch
发展
设置
同时安装库依赖项和 测试:
$ pip install -q -r requirements.txt $ pip install -q -r test_requirements.txt
测试
使用unittest运行测试并生成覆盖率报告:
./test-runner.sh
如果要在Docker容器中运行测试,请生成 Docker.test。