commitizen 4.16.0__py3-none-any.whl → 4.16.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
commitizen/__version__.py CHANGED
@@ -1 +1 @@
1
- __version__ = "4.16.0"
1
+ __version__ = "4.16.2"
@@ -1,5 +1,6 @@
1
1
  from __future__ import annotations
2
2
 
3
+ from collections import OrderedDict
3
4
  from pathlib import Path
4
5
  from typing import TYPE_CHECKING, Any
5
6
 
@@ -19,11 +20,29 @@ else:
19
20
 
20
21
  from commitizen import defaults
21
22
  from commitizen.cz.base import BaseCommitizen
23
+ from commitizen.defaults import MAJOR, MINOR
22
24
  from commitizen.exceptions import MissingCzCustomizeConfigError
23
25
 
24
26
  __all__ = ["CustomizeCommitsCz"]
25
27
 
26
28
 
29
+ def _derive_major_version_zero(
30
+ bump_map: Mapping[str, str],
31
+ ) -> OrderedDict[str, str]:
32
+ """Derive a ``bump_map_major_version_zero`` from a user-supplied
33
+ ``bump_map`` by demoting any ``MAJOR`` rule to ``MINOR``.
34
+
35
+ See #1728: when a ``cz_customize`` user supplies ``bump_map`` but not
36
+ ``bump_map_major_version_zero``, the latter previously fell through to
37
+ ``defaults.BUMP_MAP_MAJOR_VERSION_ZERO``, silently overriding the
38
+ user's intent during ``major_version_zero = true`` bumps.
39
+ """
40
+ return OrderedDict(
41
+ (pattern, MINOR if increment == MAJOR else increment)
42
+ for pattern, increment in bump_map.items()
43
+ )
44
+
45
+
27
46
  class CustomizeCommitsCz(BaseCommitizen):
28
47
  bump_pattern = defaults.BUMP_PATTERN
29
48
  bump_map = defaults.BUMP_MAP
@@ -49,6 +68,16 @@ class CustomizeCommitsCz(BaseCommitizen):
49
68
  if value := self.custom_settings.get(attr_name):
50
69
  setattr(self, attr_name, value)
51
70
 
71
+ # When the user supplies a custom ``bump_map`` but no matching
72
+ # ``bump_map_major_version_zero``, derive the latter so that bumps
73
+ # under ``major_version_zero = true`` use the user's mapping rather
74
+ # than the (totally unrelated) ``defaults.BUMP_MAP_MAJOR_VERSION_ZERO``
75
+ # fallback. See #1728.
76
+ if self.custom_settings.get("bump_map") and not self.custom_settings.get(
77
+ "bump_map_major_version_zero"
78
+ ):
79
+ self.bump_map_major_version_zero = _derive_major_version_zero(self.bump_map)
80
+
52
81
  def questions(self) -> list[CzQuestion]:
53
82
  return self.custom_settings.get("questions", [{}]) # type: ignore[return-value]
54
83
 
commitizen/defaults.py CHANGED
@@ -156,8 +156,17 @@ def get_tag_regexes(
156
156
  "major": r"(?P<major>\d+)",
157
157
  "minor": r"(?P<minor>\d+)",
158
158
  "patch": r"(?P<patch>\d+)",
159
- "prerelease": r"(?P<prerelease>\w+\d+)?",
160
- "devrelease": r"(?P<devrelease>\.dev\d+)?",
159
+ # Allow ``\w+`` (PEP-440 ``rc0``) as well as ``\w+\.\w+(\.\w+)*``
160
+ # (SemVer2 ``rc.0``, ``alpha.beta.1``). The original ``\w+\d+`` only
161
+ # matched the PEP-440 form and produced "Invalid version tag" warnings
162
+ # for SemVer2-style tags created by commitizen itself (#1614).
163
+ "prerelease": r"(?P<prerelease>\w+(?:\.\w+)*)?",
164
+ # Match either ``.dev1`` (PEP-440 with leading dot) or ``dev1``
165
+ # (SemVer / SemVer2 / users substituting ``${devrelease}`` directly
166
+ # in a ``tag_format`` -- see #1615). A bare ``\d+`` after the prefix
167
+ # would let the regex match arbitrary numeric suffixes, so the
168
+ # ``dev`` literal is required.
169
+ "devrelease": r"(?P<devrelease>\.?dev\d+)?",
161
170
  }
162
171
  return {
163
172
  **{f"${k}": v for k, v in regexes.items()},
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: commitizen
3
- Version: 4.16.0
3
+ Version: 4.16.2
4
4
  Summary: Python commitizen client tool
5
5
  Keywords: commitizen,conventional,commits,git
6
6
  Author: Santiago Fraire
@@ -1,6 +1,6 @@
1
1
  commitizen/__init__.py,sha256=oOBG9f3DtTPmFnqXnwvuh1XIw9kqf_-cyrFYlRaZ1fQ,593
2
2
  commitizen/__main__.py,sha256=ythPim4R6rgC0zU9siklq1oSbkk2HlbiNpwwoegk8uE,71
3
- commitizen/__version__.py,sha256=jqZFarxQPRfyIPY1ojpY1Nm-BNzQbn-cIh6gBXR-dN8,23
3
+ commitizen/__version__.py,sha256=Qt0QjOyIrJ-OIX6QFEmixxEe1z6R7WiLNtKJ3RM1Txo,23
4
4
  commitizen/bump.py,sha256=1UHY3n1GSbbbhQApuaVtnbuH-bqWkoa75gvHAe8O59Y,4716
5
5
  commitizen/changelog.py,sha256=U8XphsPUVhWpg9Ms1YIOybTlRNQAktVmAfqLyxDFfvc,11294
6
6
  commitizen/changelog_formats/__init__.py,sha256=ZkxdmGybxWTzQZbt5KTJdAdbdKx0-v3aXtNDC-efRQk,3369
@@ -34,14 +34,14 @@ commitizen/cz/conventional_commits/__init__.py,sha256=GZHCs25rv1p1dp4BNczL5FU_pP
34
34
  commitizen/cz/conventional_commits/conventional_commits.py,sha256=pYmZUb5cPe2_qjDDlpWZmbbzuhOXES-hHCptWFV5Zd0,7407
35
35
  commitizen/cz/conventional_commits/conventional_commits_info.txt,sha256=FqhncEblZC1IYYW7MXhOkA_YOvgO8a1F8-kWSNHVOi8,1285
36
36
  commitizen/cz/customize/__init__.py,sha256=YuZc8zjgiZ3qxCuZ_T81okOzhzhenKzNr9G0d7WBzV0,56
37
- commitizen/cz/customize/customize.py,sha256=CJ0HuEeNksffNWH0IPFKZWRcv8PvdTYUeTI4lWto3QA,2479
37
+ commitizen/cz/customize/customize.py,sha256=GjqZeA0L5ck25nqSi6GmqZPkA3oq3DAUOwO_3r3sfM4,3777
38
38
  commitizen/cz/customize/customize_info.txt,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
39
39
  commitizen/cz/exceptions.py,sha256=6d4hEBKL0fPDXjyi5hK1gOv3vyMS0Eyq8BTvO93V924,80
40
40
  commitizen/cz/jira/__init__.py,sha256=9zcifxnhAjTuPiWXLmh_QhC2Lb7hwyxgtE90QhPP7eg,57
41
41
  commitizen/cz/jira/jira.py,sha256=IyeXj-5Oz3l3OcAgAX-CX3lyOJOkXOJ1poWq81NhkJM,2571
42
42
  commitizen/cz/jira/jira_info.txt,sha256=GVLlYhUvWJX-8ej_vVrR-lmcUqOBnb5XzkVQOZOzTqA,1940
43
43
  commitizen/cz/utils.py,sha256=lx1xuIl0ZjZtcsvMKBLCz3JfKACwFmgb3F1WoRBRU6o,833
44
- commitizen/defaults.py,sha256=MbLCKF4BP-WcxTj74DeKIf4ptj83ji_A3_y0FbkbsBM,5566
44
+ commitizen/defaults.py,sha256=QRoRpVaDcv1xlpEsElj1VWBWytHohNrXrOGPKYv-kek,6210
45
45
  commitizen/exceptions.py,sha256=pQzvqtDbiFOp-9DSGmI7IMBBd73uAWH22XZTMpYbAJY,7736
46
46
  commitizen/factory.py,sha256=zz6QTr3jsbcTb4oOBWpKt_qgkysM7Q8Kel1lZSjsvkI,612
47
47
  commitizen/git.py,sha256=4Bl2_tJfvAH9ERCKht7vt3e-oA90vROv57f8tu3662k,10188
@@ -67,8 +67,8 @@ commitizen/templates/CHANGELOG.rst.j2,sha256=XHh4a7S83Z5Vrd_0UaLDA1Bb7A82Px4eHcb
67
67
  commitizen/templates/CHANGELOG.textile.j2,sha256=8JxCcDdgQUmNPxXFEv5IpbP_vcfvYCo5CSicNCZmFCY,404
68
68
  commitizen/version_increment.py,sha256=9FKa1dYONLoThdN6_IpqwgjiulyrgP8kZl4jm0jMlPM,826
69
69
  commitizen/version_schemes.py,sha256=_sm1whwldpZgqM7vdrnuGvI9nWikPJVEKm8AfHL-9vQ,13697
70
- commitizen-4.16.0.dist-info/licenses/LICENSE,sha256=fcwnXedHaDQQEjgNZZgiCm3fXZBrs99zmEtifqe-pE0,1065
71
- commitizen-4.16.0.dist-info/WHEEL,sha256=XkDrRXQq-qVsrKMtsDUOHeLkiG7UK4Ds0JuG05OqKU4,81
72
- commitizen-4.16.0.dist-info/entry_points.txt,sha256=EpbOUAABRQCFhf2HFcmrJZLGsbB_MSJ-tFua-NxUCxE,1085
73
- commitizen-4.16.0.dist-info/METADATA,sha256=Z_YP6MMWueJMds9hCAOnv9fJxbH1oKeAeUZcSVZGPyY,12291
74
- commitizen-4.16.0.dist-info/RECORD,,
70
+ commitizen-4.16.2.dist-info/licenses/LICENSE,sha256=fcwnXedHaDQQEjgNZZgiCm3fXZBrs99zmEtifqe-pE0,1065
71
+ commitizen-4.16.2.dist-info/WHEEL,sha256=fWriCkzqm-pffF5af4gJC9iI5FMFaJTuN9UxxxzOmdY,81
72
+ commitizen-4.16.2.dist-info/entry_points.txt,sha256=EpbOUAABRQCFhf2HFcmrJZLGsbB_MSJ-tFua-NxUCxE,1085
73
+ commitizen-4.16.2.dist-info/METADATA,sha256=l5Vck-4NtKR3bCo2u7MY0GOgGGPzsP-vMPtZ6IZYHAI,12291
74
+ commitizen-4.16.2.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: uv 0.11.13
2
+ Generator: uv 0.11.14
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any