Ejemplo n.º 1
0
    def sync_vcpkg_repo(vcpkg_details: VcpkgReleaseDetails,
                        project_details: ProjectDetails,
                        new_version: Version) -> None:
        print('Updating vcpkg repo and creating branch')
        with use_directory(vcpkg_details.vcpkg_repo_dir):
            print(os.getcwd())
            repo = Repo('.')
            repo.git.checkout('master')

            repo.remote('upstream').pull('master')
            try:
                repo.remote('origin').push('master')
            except GitCommandError:
                # If we are only preparing a release, not deploying, a failure
                # to push here (e.g. if being from GitHub Actions, to test release
                # preparation) is harmless, so just continue.
                print(
                    f"INFO: No permission to push to remote repo in {vcpkg_details.vcpkg_repo_dir}"
                )

            new_branch = PrepareVcpkgRelease.get_new_branch_name(
                project_details, new_version)
            print(repo.heads)
            if new_branch in repo.heads:

                def delete_branch() -> None:
                    print(f"Deleting previously-created branch {new_branch}")
                    repo.delete_head(
                        new_branch)  # only works if not checked out

                optional_action(
                    f'Branch {new_branch} already exists in vcpkg repo: Do you want to delete it?',
                    delete_branch)
            current = repo.create_head(new_branch)
            current.checkout()
Ejemplo n.º 2
0
    def sync_conan_repo(conan_details: ConanReleaseDetails,
                        project_details: ProjectDetails,
                        new_version: Version) -> None:
        print('Updating conan repo and creating branch')
        with use_directory(conan_details.conan_repo_dir):
            print(os.getcwd())
            repo = Repo('.')
            repo.git.checkout('master')

            repo.remote('upstream').pull('master')
            repo.remote('origin').push('master')

            new_branch = PrepareConanRelease.get_new_branch_name(
                project_details, new_version)
            print(repo.heads)
            if new_branch in repo.heads:

                def delete_branch() -> None:
                    print(f"Deleting previously-created branch {new_branch}")
                    repo.delete_head(
                        new_branch)  # only works if not checked out

                optional_action(
                    f'Branch {new_branch} already exists in conan repo: Do you want to delete it?',
                    delete_branch)
            current = repo.create_head(new_branch)
            current.checkout()