Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(bump): manual version bump if prerelease offset is configured #1358

Merged
Show file tree
Hide file tree
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
5 changes: 0 additions & 5 deletions commitizen/commands/bump.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,11 +187,6 @@ def __call__(self) -> None: # noqa: C901
"--major-version-zero cannot be combined with MANUAL_VERSION"
)

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

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

Expand Down
2 changes: 1 addition & 1 deletion docs/commands/bump.md
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,7 @@ post_bump_hooks = [

### `prerelease_offset`

Offset with which to start counting prereleses.
Offset with which to start counting prereleases.

Defaults to: `0`

Expand Down
17 changes: 0 additions & 17 deletions tests/commands/test_bump_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -1041,23 +1041,6 @@ def test_bump_with_hooks_and_increment(mocker: MockFixture, tmp_commitizen_proje
assert tag_exists is True


@pytest.mark.usefixtures("tmp_commitizen_project")
def test_bump_manual_version_disallows_prerelease_offset(mocker):
create_file_and_commit("feat: new file")

manual_version = "0.2.0"
testargs = ["cz", "bump", "--yes", "--prerelease-offset", "42", manual_version]
mocker.patch.object(sys, "argv", testargs)

with pytest.raises(NotAllowed) as excinfo:
cli.main()

expected_error_message = (
"--prerelease-offset cannot be combined with MANUAL_VERSION"
)
assert expected_error_message in str(excinfo.value)


@pytest.mark.usefixtures("tmp_git_project")
def test_bump_use_version_provider(mocker: MockFixture):
mock = mocker.MagicMock(name="provider")
Expand Down
Loading