Skip to content

Commit 788a8b4

Browse files
authored
Merge branch 'v5' into issue-1119
2 parents 34543d5 + 33c670e commit 788a8b4

28 files changed

+704
-673
lines changed

.github/workflows/pythonpackage.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ jobs:
66
python-check:
77
strategy:
88
matrix:
9-
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13-dev"]
9+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
1010
platform: [ubuntu-20.04, macos-latest, windows-latest]
1111
runs-on: ${{ matrix.platform }}
1212
steps:
@@ -30,7 +30,7 @@ jobs:
3030
shell: bash
3131
- name: Upload coverage to Codecov
3232
if: runner.os == 'Linux'
33-
uses: codecov/codecov-action@v4
33+
uses: codecov/codecov-action@v5
3434
with:
3535
token: ${{ secrets.CODECOV_TOKEN }}
3636
file: ./coverage.xml

.pre-commit-config.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ default_install_hook_types:
44
- pre-push
55

66
default_stages:
7-
- commit
8-
- push
7+
- pre-commit
8+
- pre-push
99

1010
repos:
1111
- repo: meta
@@ -49,13 +49,13 @@ repos:
4949
- tomli
5050

5151
- repo: https://github.com/commitizen-tools/commitizen
52-
rev: v3.30.0 # automatically updated by Commitizen
52+
rev: v4.0.0 # automatically updated by Commitizen
5353
hooks:
5454
- id: commitizen
5555
- id: commitizen-branch
5656
stages:
5757
- post-commit
58-
- push
58+
- pre-push
5959

6060
- repo: local
6161
hooks:
@@ -70,6 +70,6 @@ repos:
7070
name: linter and test
7171
language: system
7272
pass_filenames: false
73-
stages: [ push ]
73+
stages: [ pre-push ]
7474
entry: ./scripts/test
7575
types: [ python ]

.pre-commit-hooks.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
Check whether the current commit message follows committing rules. Allow
55
empty commit messages by default, because they typically indicate to Git
66
that the commit should be aborted.
7-
entry: cz check
8-
args: [--allow-abort, --commit-msg-file]
7+
entry: cz
8+
args: [check, --allow-abort, --commit-msg-file]
99
stages: [commit-msg]
1010
language: python
1111
language_version: python3
@@ -18,8 +18,8 @@
1818
default branch on the origin repository. Useful for checking messages after
1919
the fact (e.g., pre-push or in CI) without an expensive check of the entire
2020
repository history.
21-
entry: cz check
22-
args: [--rev-range, origin/HEAD..HEAD]
21+
entry: cz
22+
args: [--no-raise, '3', check, --rev-range, origin/HEAD..HEAD]
2323
always_run: true
2424
pass_filenames: false
2525
language: python

CHANGELOG.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,24 @@
1+
## v4.0.0 (2024-11-26)
2+
3+
## v3.31.0 (2024-11-16)
4+
5+
### Feat
6+
7+
- **commitizen**: document '--' double dash in '--help'
8+
9+
### Fix
10+
11+
- **commit**: avoid warnings with 'always_signoff' configuration
12+
- **commit**: resolve 'always_signoff' configuration and '-s' CLI issues
13+
14+
## v3.30.1 (2024-11-10)
15+
16+
### Refactor
17+
18+
- **cli**: replace magic number 0 with ExitCode.EXPECTED_EXIT
19+
- **defaults**: disallow style as None
20+
- **cz_customize**: return empty string for info, example, schema and schema_pattern if not provided
21+
122
## v3.30.0 (2024-10-23)
223

324
### Feat

commitizen/__version__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "3.30.0"
1+
__version__ = "4.0.0"

commitizen/changelog.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,10 @@
2929

3030
import re
3131
from collections import OrderedDict, defaultdict
32+
from collections.abc import Iterable
3233
from dataclasses import dataclass
3334
from datetime import date
34-
from typing import TYPE_CHECKING, Iterable
35+
from typing import TYPE_CHECKING
3536

3637
from jinja2 import (
3738
BaseLoader,

commitizen/changelog_formats/restructuredtext.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import re
44
import sys
55
from itertools import zip_longest
6-
from typing import IO, TYPE_CHECKING, Any, Tuple, Union
6+
from typing import IO, TYPE_CHECKING, Any, Union
77

88
from commitizen.changelog import Metadata
99

@@ -18,7 +18,7 @@
1818

1919

2020
# Can't use `|` operator and native type because of https://bugs.python.org/issue42233 only fixed in 3.10
21-
TitleKind: TypeAlias = Union[str, Tuple[str, str]]
21+
TitleKind: TypeAlias = Union[str, tuple[str, str]]
2222

2323

2424
class RestructuredText(BaseFormat):

commitizen/cli.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@
33
import argparse
44
import logging
55
import sys
6+
from collections.abc import Sequence
67
from copy import deepcopy
78
from functools import partial
89
from pathlib import Path
910
from types import TracebackType
10-
from typing import Any, Sequence
11+
from typing import Any
1112

1213
import argcomplete
1314
from decli import cli
@@ -168,6 +169,12 @@ def __call__(
168169
"default": 0,
169170
"help": "length limit of the commit message; 0 for no limit",
170171
},
172+
{
173+
"name": ["--"],
174+
"action": "store_true",
175+
"dest": "double_dash",
176+
"help": "Positional arguments separator (recommended)",
177+
},
171178
],
172179
},
173180
{
@@ -547,7 +554,7 @@ def commitizen_excepthook(
547554
original_excepthook(type, value, traceback)
548555
exit_code = value.exit_code
549556
if exit_code in no_raise:
550-
exit_code = 0
557+
exit_code = ExitCode.EXPECTED_EXIT
551558
sys.exit(exit_code)
552559
else:
553560
original_excepthook(type, value, traceback)

commitizen/commands/check.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def _valid_command_argument(self):
5454
for arg in (self.commit_msg_file, self.commit_msg, self.rev_range)
5555
)
5656
if num_exclusive_args_provided == 0 and not sys.stdin.isatty():
57-
self.commit_msg: str | None = sys.stdin.read()
57+
self.commit_msg = sys.stdin.read()
5858
elif num_exclusive_args_provided != 1:
5959
raise InvalidCommandArgumentError(
6060
"Only one of --rev-range, --message, and --commit-msg-file is permitted by check command! "
@@ -107,7 +107,9 @@ def _get_commits(self):
107107
return [git.GitCommit(rev="", title="", body=msg)]
108108

109109
# Get commit messages from git log (--rev-range)
110-
return git.get_commits(end=self.rev_range)
110+
if self.rev_range:
111+
return git.get_commits(end=self.rev_range)
112+
return git.get_commits()
111113

112114
@staticmethod
113115
def _filter_comments(msg: str) -> str:

commitizen/commands/commit.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -134,17 +134,18 @@ def __call__(self):
134134
if dry_run:
135135
raise DryRunExit()
136136

137-
signoff: bool = (
138-
self.arguments.get("signoff") or self.config.settings["always_signoff"]
139-
)
137+
always_signoff: bool = self.config.settings["always_signoff"]
138+
signoff: bool = self.arguments.get("signoff")
139+
140+
extra_args = self.arguments.get("extra_cli_args", "")
140141

141142
if signoff:
142143
out.warn(
143144
"signoff mechanic is deprecated, please use `cz commit -- -s` instead."
144145
)
145-
extra_args = self.arguments.get("extra_cli_args", "--") + " -s"
146-
else:
147-
extra_args = self.arguments.get("extra_cli_args", "")
146+
147+
if always_signoff or signoff:
148+
extra_args = f"{extra_args} -s".strip()
148149

149150
c = git.commit(m, args=extra_args)
150151

0 commit comments

Comments
 (0)