Skip to content

Commit 4fb5158

Browse files
committed
Fixed vague commit and tagging info
- 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
1 parent 7c12072 commit 4fb5158

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

bumpversion/scm.py

+16-3
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,13 @@ def commit_to_scm(
106106
"""Commit the files to the source code management system."""
107107
if not cls.is_usable():
108108
logger.error("SCM tool '%s' is unusable, unable to commit.", cls.__name__)
109-
do_commit = config.commit and not dry_run
109+
return
110+
111+
if not config.commit:
112+
logger.info("Would not commit")
113+
return
114+
115+
do_commit = not dry_run
110116
logger.info(
111117
"%s %s commit",
112118
"Preparing" if do_commit else "Would prepare",
@@ -146,9 +152,16 @@ def tag_in_scm(cls, config: "Config", context: MutableMapping, dry_run: bool = F
146152
tag_name = config.tag_name.format(**context)
147153
tag_message = config.tag_message.format(**context)
148154
existing_tags = cls.get_all_tags()
149-
do_tag = config.tag and not dry_run
155+
if not config.commit:
156+
logger.info("Would not tag since we are not committing")
157+
return
158+
if not config.tag:
159+
logger.info("Would not tag")
160+
return
161+
162+
do_tag = not dry_run
150163

151-
if tag_name in existing_tags and config.tag:
164+
if tag_name in existing_tags:
152165
logger.warning("Tag '%s' already exists. Will not tag.", tag_name)
153166
return
154167

0 commit comments

Comments
 (0)