Skip to content

Commit

Permalink
Fixed vague commit and tagging info
Browse files Browse the repository at this point in the history
- If commit is configured false, it will report that it will not commit

- If commit is configured false, tagging is disabled and it reports that

- If tagging is configured false, it will report it is not tagging
  • Loading branch information
coordt committed Apr 20, 2023
1 parent 7c12072 commit 4fb5158
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions bumpversion/scm.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,13 @@ def commit_to_scm(
"""Commit the files to the source code management system."""
if not cls.is_usable():
logger.error("SCM tool '%s' is unusable, unable to commit.", cls.__name__)
do_commit = config.commit and not dry_run
return

if not config.commit:
logger.info("Would not commit")
return

do_commit = not dry_run
logger.info(
"%s %s commit",
"Preparing" if do_commit else "Would prepare",
Expand Down Expand Up @@ -146,9 +152,16 @@ def tag_in_scm(cls, config: "Config", context: MutableMapping, dry_run: bool = F
tag_name = config.tag_name.format(**context)
tag_message = config.tag_message.format(**context)
existing_tags = cls.get_all_tags()
do_tag = config.tag and not dry_run
if not config.commit:
logger.info("Would not tag since we are not committing")
return
if not config.tag:
logger.info("Would not tag")
return

do_tag = not dry_run

if tag_name in existing_tags and config.tag:
if tag_name in existing_tags:
logger.warning("Tag '%s' already exists. Will not tag.", tag_name)
return

Expand Down

0 comments on commit 4fb5158

Please sign in to comment.