def make_testing_branch():
repo = Repo('.')
gitobj = repo.git
# create 'test' branch if it doesn't exist so that it can be used for tests in this module
git_branch_string = gitobj.branch()
git_branch_list = git_branch_string.split("\n")
clean_branch_list = []
for branch in git_branch_list:
branch = branch.replace('*', '')
branch = branch.replace(' ', '')
clean_branch_list.append(branch)
if 'testing_branch' in clean_branch_list:
pass
else:
gitobj.branch('testing_branch')
# deletes the temporary new git branch (testing_branch) for testing
评论列表
文章目录