| 60 | |
| 61 | |
| 62 | def clone(target_dir: str, commit: str | None, repo_source: str | None = None) -> None: |
| 63 | source_name = repo_source or "mypy" |
| 64 | heading(f"Cloning {source_name} to {target_dir}") |
| 65 | if repo_source is None: |
| 66 | repo_source = os.getcwd() |
| 67 | if os.path.isdir(target_dir): |
| 68 | print(f"{target_dir} exists: deleting") |
| 69 | shutil.rmtree(target_dir) |
| 70 | subprocess.run(["git", "clone", repo_source, target_dir], check=True) |
| 71 | if commit: |
| 72 | subprocess.run(["git", "checkout", commit], check=True, cwd=target_dir) |
| 73 | |
| 74 | |
| 75 | def edit_python_file(fnam: str) -> None: |