@@ -51,14 +51,14 @@ def update_demo(
5151
5252 if branch_override is not None :
5353 typer .secho (f"Overriding current branch name for demo reference. Using '{ branch_override } ' instead." )
54- current_branch : str = branch_override
54+ desired_branch_name : str = branch_override
5555 else :
56- current_branch : str = get_current_branch ()
56+ desired_branch_name : str = get_current_branch ()
5757 template_commit : str = get_current_commit ()
5858
59- _validate_template_main_not_checked_out (branch = current_branch )
59+ _validate_template_main_not_checked_out (branch = desired_branch_name )
6060 require_clean_and_up_to_date_demo_repo (demo_path = demo_path )
61- _checkout_demo_develop_or_existing_branch (demo_path = demo_path , branch = current_branch )
61+ _checkout_demo_develop_or_existing_branch (demo_path = demo_path , branch = desired_branch_name )
6262 last_update_commit : str = get_last_cruft_update_commit (demo_path = demo_path )
6363
6464 if not is_ancestor (last_update_commit , template_commit ):
@@ -69,6 +69,9 @@ def update_demo(
6969
7070 typer .secho (f"Updating demo project at { demo_path = } ." , fg = "yellow" )
7171 with work_in (demo_path ):
72+ if get_current_branch () != desired_branch_name :
73+ git ("checkout" , "-b" , desired_branch_name , DEMO .develop_branch )
74+
7275 uv ("python" , "pin" , min_python_version )
7376 uv ("python" , "install" , min_python_version )
7477 cruft .update (
@@ -84,9 +87,9 @@ def update_demo(
8487 uv ("lock" )
8588 git ("add" , "." )
8689 git ("commit" , "-m" , f"chore: { last_update_commit } -> { template_commit } " , "--no-verify" )
87- git ("push" , "-u" , "origin" , current_branch )
88- if current_branch != "develop" :
89- _create_demo_pr (demo_path = demo_path , branch = current_branch , commit_start = last_update_commit )
90+ git ("push" , "-u" , "origin" , desired_branch_name )
91+ if desired_branch_name != "develop" :
92+ _create_demo_pr (demo_path = demo_path , branch = desired_branch_name , commit_start = last_update_commit )
9093
9194
9295def _checkout_demo_develop_or_existing_branch (demo_path : Path , branch : str ) -> None :
0 commit comments