def main(): # identify local packages in the environment and clone if they don't exist for package in environment.local_packages: pkg_path = locate_local_package(package) prj_repo_name = f"{DEFAULT_BRANCH}-{PROJECT_NAME}" # if package is local, switch to base branch "dev-init" if pkg_path: # switch branch to dev_init repo = Repo(pkg_path) if repo.active_branch.name != BASE_BRANCH: repo.git.checkout(BASE_BRANCH) repo.git.pull() # otherwise clone the package from github else: print(f'Cloning {package}') repo = Repo.clone_from(url=f'{RP_GITHUB_URL}/{package}', to_path=str(pkg_path), branch=BASE_BRANCH) # check if the project branch exists, if not create it if not check_branch(pkg_path, prj_repo_name): repo.create_head(prj_repo_name) # check out the project branch and push up to github repo.git.checkout(prj_repo_name) repo.git.push()