Skip to content
This repository was archived by the owner on Mar 13, 2024. It is now read-only.

Commit 8061125

Browse files
OCoppingcoretl
authored andcommitted
Changed all hard-coded branch names to be MERGE_BRANCH; Changed print message to raise Exception
1 parent 7d47ee1 commit 8061125

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/dls_python3_skeleton/__main__.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,11 @@ def replace_text(text: str) -> str:
6868

6969
branches = [x[2:] for x in str(git("branch", "--list")).split("\n")]
7070

71-
if "skeleton-merge-branch" in branches:
72-
print("Merge branch already exists. Skipping creation...")
71+
if f"{MERGE_BRANCH}" in branches:
72+
raise Exception(
73+
f"{MERGE_BRANCH} already exists. \
74+
Please run 'dls-python3-skeleton clean' to remove it."
75+
)
7376
else:
7477
with GitTemporaryDirectory() as git_tmp:
7578
# Clone existing repo into tmp so we don't mess up if we fail
@@ -190,11 +193,11 @@ def clean_repo(args):
190193

191194
branches = [x[2:] for x in str(git("branch", "--list")).split("\n")]
192195
assert (
193-
"skeleton-merge-branch" in branches
194-
), "Expected skeleton-merge-branch to be in existing repo"
196+
f"{MERGE_BRANCH}" in branches
197+
), f"Expected {MERGE_BRANCH} to be in existing repo"
195198

196-
git("branch", "-D", "skeleton-merge-branch")
197-
print("skeleton-merge-branch deleted from existing repo")
199+
git("branch", "-D", f"{MERGE_BRANCH}")
200+
print(f"{MERGE_BRANCH} deleted from existing repo")
198201

199202

200203
def main(args=None):

0 commit comments

Comments
 (0)