Skip to content

Commit 029c5c9

Browse files
committed
chore(core): test bump commit msg version [patch candidate]
1 parent 209f18d commit 029c5c9

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

commit_msg_version_bump/main.py

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -128,12 +128,9 @@ def get_pushed_refs() -> List[str]:
128128
sys.exit(1)
129129

130130

131-
def get_upstream_branch(local_ref: str) -> Optional[str]:
131+
def get_upstream_branch() -> Optional[str]:
132132
"""
133-
Retrieves the upstream branch for a given local ref.
134-
135-
Args:
136-
local_ref (str): The local ref being pushed.
133+
Retrieves the upstream branch for the current branch.
137134
138135
Returns:
139136
Optional[str]: The upstream branch name or None if not found.
@@ -146,10 +143,10 @@ def get_upstream_branch(local_ref: str) -> Optional[str]:
146143
stderr=subprocess.PIPE,
147144
text=True,
148145
).stdout.strip()
149-
logger.debug(f"Upstream branch for {local_ref}: {upstream}")
146+
logger.debug(f"Upstream branch: {upstream}")
150147
return upstream
151148
except subprocess.CalledProcessError as e:
152-
logger.error(f"Error retrieving upstream branch for {local_ref}: {e.stderr}")
149+
logger.error(f"Error retrieving upstream branch: {e.stderr}")
153150
return None
154151

155152

@@ -353,12 +350,12 @@ def main() -> None:
353350
logger.info("No refs being pushed.")
354351
return
355352

356-
for local_ref in pushed_refs:
357-
upstream_ref = get_upstream_branch(local_ref)
358-
if not upstream_ref:
359-
logger.warning(f"No upstream branch found for {local_ref}. Skipping.")
360-
continue
353+
upstream_ref = get_upstream_branch()
354+
if not upstream_ref:
355+
logger.error("No upstream branch found. Aborting.")
356+
sys.exit(1)
361357

358+
for local_ref in pushed_refs:
362359
commits = get_commits_being_pushed(local_ref, upstream_ref)
363360
if not commits:
364361
logger.info(f"No new commits to process for {local_ref}.")

0 commit comments

Comments
 (0)