|
| 1 | +# /// script |
| 2 | +# requires-python = ">=3.10" |
| 3 | +# dependencies = [ |
| 4 | +# "cookiecutter", |
| 5 | +# "cruft", |
| 6 | +# "python-dotenv", |
| 7 | +# "typer", |
| 8 | +# ] |
| 9 | +# /// |
| 10 | + |
1 | 11 | import sys |
2 | 12 | from pathlib import Path |
3 | 13 | from typing import Annotated |
@@ -37,7 +47,7 @@ def update_demo( |
37 | 47 | template_commit: str = get_current_commit() |
38 | 48 |
|
39 | 49 | _validate_is_feature_branch(branch=current_branch) |
40 | | - |
| 50 | + _set_demo_to_clean_develop(demo_path=demo_path) |
41 | 51 | last_update_commit: str = _get_last_demo_develop_cruft_update(demo_path=demo_path) |
42 | 52 |
|
43 | 53 | if not is_ancestor(last_update_commit, template_commit): |
@@ -73,20 +83,19 @@ def update_demo( |
73 | 83 | sys.exit(1) |
74 | 84 |
|
75 | 85 |
|
76 | | -def _get_last_demo_develop_cruft_update(demo_path: Path) -> str: |
77 | | - """Gets the last cruft update commit for the demo project's develop branch.""" |
78 | | - _prep_demo_develop(demo_path=demo_path) |
79 | | - last_update_commit: str = get_last_cruft_update_commit(demo_path=demo_path) |
80 | | - return last_update_commit |
81 | | - |
82 | | - |
83 | | -def _prep_demo_develop(demo_path: Path) -> None: |
| 86 | +def _set_demo_to_clean_develop(demo_path: Path) -> None: |
84 | 87 | """Checks out the demo development branch and validates it is up to date.""" |
85 | 88 | with work_in(demo_path): |
86 | 89 | require_clean_and_up_to_date_repo() |
87 | 90 | git("checkout", "develop") |
88 | 91 |
|
89 | 92 |
|
| 93 | +def _get_last_demo_develop_cruft_update(demo_path: Path) -> str: |
| 94 | + """Gets the last cruft update commit for the demo project's develop branch.""" |
| 95 | + last_update_commit: str = get_last_cruft_update_commit(demo_path=demo_path) |
| 96 | + return last_update_commit |
| 97 | + |
| 98 | + |
90 | 99 | def _validate_is_feature_branch(branch: str) -> None: |
91 | 100 | """Validates that the cookiecutter has a feature branch checked out.""" |
92 | 101 | if not branch.startswith("feature/"): |
|
0 commit comments