Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 14 additions & 28 deletions commitizen/commands/bump.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,36 +177,22 @@ def __call__(self) -> None:
build_metadata = self.arguments["build_metadata"]
get_next = self.arguments["get_next"]
allow_no_commit = self.arguments["allow_no_commit"]
major_version_zero = self.arguments["major_version_zero"]

if manual_version:
if increment:
raise NotAllowed("--increment cannot be combined with MANUAL_VERSION")

if prerelease:
raise NotAllowed("--prerelease cannot be combined with MANUAL_VERSION")

if devrelease is not None:
raise NotAllowed("--devrelease cannot be combined with MANUAL_VERSION")

if is_local_version:
raise NotAllowed(
"--local-version cannot be combined with MANUAL_VERSION"
)

if build_metadata:
raise NotAllowed(
"--build-metadata cannot be combined with MANUAL_VERSION"
)

if self.bump_settings["major_version_zero"]:
raise NotAllowed(
"--major-version-zero cannot be combined with MANUAL_VERSION"
)

if get_next:
raise NotAllowed("--get-next cannot be combined with MANUAL_VERSION")

if self.bump_settings["major_version_zero"] and current_version.release[0]:
for val, option in (
(increment, "--increment"),
(prerelease, "--prerelease"),
(devrelease is not None, "--devrelease"),
(is_local_version, "--local-version"),
(build_metadata, "--build-metadata"),
(major_version_zero, "--major-version-zero"),
(get_next, "--get-next"),
):
if val:
raise NotAllowed(f"{option} cannot be combined with MANUAL_VERSION")

if major_version_zero and current_version.release[0]:
raise NotAllowed(
f"--major-version-zero is meaningless for current version {current_version}"
)
Expand Down