File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -48,14 +48,10 @@ def _download_exercise(
4848 f"Downloading { exercise } to { click .style (exercise + '/' , bold = True , italic = True )} "
4949 )
5050
51+ old_config : Optional [ExerciseConfig ] = None
5152 if os .path .isdir (exercise ):
5253 warn (f"You already have { exercise } , removing it to download again" )
5354 old_config = ExerciseConfig .read (Path (exercise ), 0 )
54- if old_config .exercise_repo .repo_type == "remote" and old_config .exercise_repo .create_fork :
55- pr_repo_full_name = old_config .exercise_repo .pr_repo_full_name
56- if pr_repo_full_name :
57- info (f"Closing any open PRs in { pr_repo_full_name } ..." )
58- close_pr (pr_repo_full_name )
5955 rmtree (exercise )
6056
6157 os .makedirs (exercise )
@@ -101,6 +97,12 @@ def _download_exercise(
10197 warn ("Setup Github and Github CLI before downloading this exercise" )
10298 sys .exit (1 )
10399
100+ if old_config and old_config .exercise_repo .repo_type == "remote" and old_config .exercise_repo .create_fork :
101+ pr_repo_full_name = old_config .exercise_repo .pr_repo_full_name
102+ if pr_repo_full_name :
103+ info (f"Closing any open PRs in { pr_repo_full_name } ..." )
104+ close_pr (pr_repo_full_name )
105+
104106 if len (config .base_files ) > 0 :
105107 info ("Downloading base files..." )
106108
You can’t perform that action at this time.
0 commit comments