def render(url, refspec, dest_branch): """Render the template. \b REFSPEC: The template branch/refspec to use for rendering [default=master] GHT_BRANCH: The destination branch of the rendered results [default=ght/master] """ if not dest_branch.startswith("ght/"): raise click.ClickException( "Refusing to render the template." f"The destination branch `{dest_branch}` does not begin ght/.") repo_path = resolve_repository_path(".") ght = GHT(repo_path=repo_path, template_url=url, template_ref=refspec) ght.load_config() if ght.template_url is None: raise click.ClickException( "Could not detect the template repository url. " "Please set it manually with -u/--url") with stashed_checkout(ght.repo, dest_branch): ght.render_tree() return 0
def test_render_tree(ght: GHT): ght.render_tree() assert "ght/template" not in ght.repo.heads