Skip to content
Open
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
18 changes: 17 additions & 1 deletion commitizen/bump.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@


def find_increment(
commits: list[GitCommit], regex: str, increments_map: dict | OrderedDict
commits: list[GitCommit],
regex: str,
increments_map: dict | OrderedDict,
ignore_bump_rev_list: list[str] | None = None,
ignore_bump_author_list: list[str] | None = None,
) -> Increment | None:
if isinstance(increments_map, dict):
increments_map = OrderedDict(increments_map)
Expand All @@ -34,6 +38,18 @@ def find_increment(
increment: str | None = None

for commit in commits:
if ignore_bump_rev_list and commit.rev in ignore_bump_rev_list:
logger.debug(
f"Skipping commit {commit.rev} as it's in ignore_bump_rev_list"
)
continue

if ignore_bump_author_list and commit.author in ignore_bump_author_list:
logger.debug(
f"Skipping commit {commit.rev} as its author '{commit.author}' is in ignore_bump_author_list"
Copy link

Copilot AI Feb 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The debug log message on this line exceeds the configured formatter/linter max line length (88 in pyproject.toml). Please wrap/reformat the string (or split it across lines) to avoid CI formatting/lint failures.

Suggested change
f"Skipping commit {commit.rev} as its author '{commit.author}' is in ignore_bump_author_list"
"Skipping commit %s as its author '%s' is in ignore_bump_author_list",
commit.rev,
commit.author,

Copilot uses AI. Check for mistakes.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to check what logger actually does

)
continue

for message in commit.message.split("\n"):
result = select_pattern.search(message)

Expand Down
20 changes: 17 additions & 3 deletions commitizen/commands/bump.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@ def __init__(self, config: BaseConfig, arguments: BumpArgs) -> None:
self.retry = arguments["retry"]
self.pre_bump_hooks = self.config.settings["pre_bump_hooks"]
self.post_bump_hooks = self.config.settings["post_bump_hooks"]
self.ignore_bump_rev_list = self.config.settings.get("ignore_bump_rev_list")
self.ignore_bump_author_list = self.config.settings.get(
"ignore_bump_author_list"
)
deprecated_version_type = arguments.get("version_type")
if deprecated_version_type:
warnings.warn(
Expand Down Expand Up @@ -158,7 +162,13 @@ def _find_increment(self, commits: list[git.GitCommit]) -> Increment | None:
raise NoPatternMapError(
f"'{self.config.settings['name']}' rule does not support bump"
)
return bump.find_increment(commits, regex=bump_pattern, increments_map=bump_map)
return bump.find_increment(
commits,
regex=bump_pattern,
increments_map=bump_map,
ignore_bump_rev_list=self.ignore_bump_rev_list,
ignore_bump_author_list=self.ignore_bump_author_list,
)

def _validate_arguments(self, current_version: VersionProtocol) -> None:
errors: list[str] = []
Expand Down Expand Up @@ -363,7 +373,9 @@ def __call__(self) -> None:
new_tag_version=new_tag_version,
message=message,
increment=increment,
changelog_file_name=changelog_file_name,
changelog_file_name=(
changelog_cmd.file_name if self.changelog_flag else None
),
)

if self.arguments.get("files_only"):
Expand Down Expand Up @@ -426,7 +438,9 @@ def __call__(self) -> None:
current_tag_version=new_tag_version,
message=message,
increment=increment,
changelog_file_name=changelog_file_name,
changelog_file_name=(
changelog_cmd.file_name if self.changelog_flag else None
),
)

# TODO: For v3 output this only as diagnostic and remove this if
Expand Down
2 changes: 2 additions & 0 deletions commitizen/defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ class Settings(TypedDict, total=False):
version_type: str | None
version: str | None
breaking_change_exclamation_in_title: bool
ignore_bump_rev_list: list[str] | None
ignore_bump_author_list: list[str] | None


CONFIG_FILES: tuple[str, ...] = (
Expand Down
54 changes: 54 additions & 0 deletions docs/config/bump.md
Original file line number Diff line number Diff line change
Expand Up @@ -215,3 +215,57 @@ version_files = [
## `version_scheme`

See [`--version-scheme`](../commands/bump.md#-version-scheme).

Here’s a clearer, more consistent rewrite with tightened wording, corrected descriptions, and parallel structure between the two options.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove


## `ignore_bump_rev_list`

- Type: `list`
- Default: `[]`
Comment on lines +219 to +224
Copy link

Copilot AI Feb 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sentence reads like meta commentary about the doc rewrite rather than user-facing documentation. Please remove it (or replace it with content that describes the settings) so the config page stays focused and professional.

Suggested change
Here’s a clearer, more consistent rewrite with tightened wording, corrected descriptions, and parallel structure between the two options.
## `ignore_bump_rev_list`
- Type: `list`
- Default: `[]`
## `ignore_bump_rev_list`
- Type: `list`
- Default: `[]`
- Type: `list`
- Default: `[]`

Copilot uses AI. Check for mistakes.

A list of git commit revisions (SHAs) that should be excluded from version bump calculation.

For example, given the following commit:

```text
commit e302cb4f2c626099b4a9c8cf881b0bb5906b7356
Author: example_user <example@gmail.com>
Date: Sat Feb 1 21:00:00 2026 +0800
feat: add a new test file, this should not be bumped
```

Configure `pyproject.toml` as follows:

```toml title="pyproject.toml"
[tool.commitizen]
ignore_bump_rev_list = ["e302cb4f2c626099b4a9c8cf881b0bb5906b7356"]
```

As a result, this commit will be ignored when determining whether a version bump is required.

## `ignore_bump_author_list`

- Type: `list`
- Default: `[]`

A list of commit authors whose commits should be excluded from version bump calculation.

For example, given the following commit:

```text
commit e302cb4f2c626099b4a9c8cf881b0bb5906b7356
Author: example_user <example@gmail.com>
Date: Sat Feb 1 21:00:00 2026 +0800
feat: add a new test file, this should not be bumped
```

Configure `pyproject.toml` as follows:

```toml title="pyproject.toml"
[tool.commitizen]
ignore_bump_author_list = ["example_user"]
```

As a result, any commit authored by `example_user` will be ignored when determining whether a version bump is required.
36 changes: 36 additions & 0 deletions tests/test_bump_find_increment.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,42 @@ def test_find_increment(messages, expected_type):
assert increment_type == expected_type


def test_find_increment_with_ignored_rev():
messages = [
"docs(README): motivation",
"feat: this should not be bumped because of the ignore_bump_rev_list",
]
commits = [
GitCommit(rev="test1", title=messages[0]),
GitCommit(rev="test2", title=messages[1]),
]
increment_type = bump.find_increment(
commits,
regex=ConventionalCommitsCz.bump_pattern,
increments_map=ConventionalCommitsCz.bump_map,
ignore_bump_rev_list=["test2"],
)
assert increment_type is None


def test_find_increment_with_ignored_author():
messages = [
"feat: this should not be bumped because of the ignore_bump_author_list",
"docs(README): motivation",
]
commits = [
GitCommit(rev="test1", title=messages[0], author="alice"),
GitCommit(rev="test2", title=messages[1], author="bob"),
]
increment_type = bump.find_increment(
commits,
regex=ConventionalCommitsCz.bump_pattern,
increments_map=ConventionalCommitsCz.bump_map,
ignore_bump_author_list=["alice"],
)
assert increment_type is None


@pytest.mark.parametrize(
("messages", "expected_type"),
[
Expand Down
Loading