commitizen 4.13.0__py3-none-any.whl → 4.13.1__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 +1 -1
- commitizen/config/__init__.py +8 -14
- commitizen/config/base_config.py +7 -1
- commitizen/config/json_config.py +7 -2
- commitizen/config/toml_config.py +6 -1
- commitizen/config/yaml_config.py +6 -3
- {commitizen-4.13.0.dist-info → commitizen-4.13.1.dist-info}/METADATA +1 -1
- {commitizen-4.13.0.dist-info → commitizen-4.13.1.dist-info}/RECORD +10 -10
- {commitizen-4.13.0.dist-info → commitizen-4.13.1.dist-info}/WHEEL +0 -0
- {commitizen-4.13.0.dist-info → commitizen-4.13.1.dist-info}/entry_points.txt +0 -0
commitizen/__version__.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "4.13.
|
|
1
|
+
__version__ = "4.13.1"
|
commitizen/config/__init__.py
CHANGED
|
@@ -13,23 +13,17 @@ def _resolve_config_candidates() -> list[BaseConfig]:
|
|
|
13
13
|
git_project_root = git.find_git_project_root()
|
|
14
14
|
cfg_search_paths = [Path(".")]
|
|
15
15
|
|
|
16
|
-
if git_project_root and
|
|
16
|
+
if git_project_root and cfg_search_paths[0].resolve() != git_project_root.resolve():
|
|
17
17
|
cfg_search_paths.append(git_project_root)
|
|
18
18
|
|
|
19
|
-
# The following algorithm is ugly, but we need to ensure that the order of the candidates are preserved before v5.
|
|
20
|
-
# Also, the number of possible config files is limited, so the complexity is not a problem.
|
|
21
19
|
candidates: list[BaseConfig] = []
|
|
22
20
|
for dir in cfg_search_paths:
|
|
23
21
|
for filename in defaults.CONFIG_FILES:
|
|
24
|
-
out_path = dir /
|
|
25
|
-
if (
|
|
26
|
-
out_path
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
)
|
|
30
|
-
and not (conf := _create_config_from_path(out_path)).is_empty_config
|
|
31
|
-
):
|
|
32
|
-
candidates.append(conf)
|
|
22
|
+
out_path = dir / filename
|
|
23
|
+
if out_path.is_file():
|
|
24
|
+
conf = _create_config_from_path(out_path)
|
|
25
|
+
if conf.contains_commitizen_section():
|
|
26
|
+
candidates.append(conf)
|
|
33
27
|
return candidates
|
|
34
28
|
|
|
35
29
|
|
|
@@ -43,10 +37,10 @@ def _create_config_from_path(path: Path) -> BaseConfig:
|
|
|
43
37
|
def read_cfg(filepath: str | None = None) -> BaseConfig:
|
|
44
38
|
if filepath is not None:
|
|
45
39
|
conf_path = Path(filepath)
|
|
46
|
-
if not conf_path.
|
|
40
|
+
if not conf_path.is_file():
|
|
47
41
|
raise ConfigFileNotFound()
|
|
48
42
|
conf = _create_config_from_path(conf_path)
|
|
49
|
-
if conf.
|
|
43
|
+
if not conf.contains_commitizen_section():
|
|
50
44
|
raise ConfigFileIsEmpty()
|
|
51
45
|
return conf
|
|
52
46
|
|
commitizen/config/base_config.py
CHANGED
|
@@ -17,10 +17,16 @@ if TYPE_CHECKING:
|
|
|
17
17
|
|
|
18
18
|
class BaseConfig:
|
|
19
19
|
def __init__(self) -> None:
|
|
20
|
-
self.is_empty_config = False
|
|
21
20
|
self._settings: Settings = DEFAULT_SETTINGS.copy()
|
|
22
21
|
self._path: Path | None = None
|
|
23
22
|
|
|
23
|
+
def contains_commitizen_section(self) -> bool:
|
|
24
|
+
"""Check if the config file contains a commitizen section.
|
|
25
|
+
|
|
26
|
+
The implementation is different for each config file type.
|
|
27
|
+
"""
|
|
28
|
+
raise NotImplementedError()
|
|
29
|
+
|
|
24
30
|
@property
|
|
25
31
|
def settings(self) -> Settings:
|
|
26
32
|
return self._settings
|
commitizen/config/json_config.py
CHANGED
|
@@ -25,6 +25,11 @@ class JsonConfig(BaseConfig):
|
|
|
25
25
|
self.path = path
|
|
26
26
|
self._parse_setting(data)
|
|
27
27
|
|
|
28
|
+
def contains_commitizen_section(self) -> bool:
|
|
29
|
+
with self.path.open("rb") as json_file:
|
|
30
|
+
config_doc = json.load(json_file)
|
|
31
|
+
return config_doc.get("commitizen") is not None
|
|
32
|
+
|
|
28
33
|
def init_empty_config_content(self) -> None:
|
|
29
34
|
with smart_open(
|
|
30
35
|
self.path, "a", encoding=self._settings["encoding"]
|
|
@@ -32,7 +37,7 @@ class JsonConfig(BaseConfig):
|
|
|
32
37
|
json.dump({"commitizen": {}}, json_file)
|
|
33
38
|
|
|
34
39
|
def set_key(self, key: str, value: object) -> Self:
|
|
35
|
-
with
|
|
40
|
+
with self.path.open("rb") as f:
|
|
36
41
|
config_doc = json.load(f)
|
|
37
42
|
|
|
38
43
|
config_doc["commitizen"][key] = value
|
|
@@ -59,4 +64,4 @@ class JsonConfig(BaseConfig):
|
|
|
59
64
|
try:
|
|
60
65
|
self.settings.update(doc["commitizen"])
|
|
61
66
|
except KeyError:
|
|
62
|
-
|
|
67
|
+
pass
|
commitizen/config/toml_config.py
CHANGED
|
@@ -26,6 +26,11 @@ class TomlConfig(BaseConfig):
|
|
|
26
26
|
self.path = path
|
|
27
27
|
self._parse_setting(data)
|
|
28
28
|
|
|
29
|
+
def contains_commitizen_section(self) -> bool:
|
|
30
|
+
with self.path.open("rb") as f:
|
|
31
|
+
config_doc = parse(f.read())
|
|
32
|
+
return config_doc.get("tool", {}).get("commitizen") is not None
|
|
33
|
+
|
|
29
34
|
def init_empty_config_content(self) -> None:
|
|
30
35
|
config_doc = TOMLDocument()
|
|
31
36
|
if os.path.isfile(self.path):
|
|
@@ -67,4 +72,4 @@ class TomlConfig(BaseConfig):
|
|
|
67
72
|
try:
|
|
68
73
|
self.settings.update(doc["tool"]["commitizen"]) # type: ignore[index,typeddict-item] # TODO: fix this
|
|
69
74
|
except exceptions.NonExistentKey:
|
|
70
|
-
|
|
75
|
+
pass
|
commitizen/config/yaml_config.py
CHANGED
|
@@ -32,6 +32,11 @@ class YAMLConfig(BaseConfig):
|
|
|
32
32
|
) as json_file:
|
|
33
33
|
yaml.dump({"commitizen": {}}, json_file, explicit_start=True)
|
|
34
34
|
|
|
35
|
+
def contains_commitizen_section(self) -> bool:
|
|
36
|
+
with self.path.open("rb") as yaml_file:
|
|
37
|
+
config_doc = yaml.load(yaml_file, Loader=yaml.FullLoader)
|
|
38
|
+
return config_doc.get("commitizen") is not None
|
|
39
|
+
|
|
35
40
|
def _parse_setting(self, data: bytes | str) -> None:
|
|
36
41
|
"""We expect to have a section in cz.yaml looking like
|
|
37
42
|
|
|
@@ -40,8 +45,6 @@ class YAMLConfig(BaseConfig):
|
|
|
40
45
|
name: cz_conventional_commits
|
|
41
46
|
```
|
|
42
47
|
"""
|
|
43
|
-
import yaml.scanner
|
|
44
|
-
|
|
45
48
|
try:
|
|
46
49
|
doc = yaml.safe_load(data)
|
|
47
50
|
except yaml.YAMLError as e:
|
|
@@ -50,7 +53,7 @@ class YAMLConfig(BaseConfig):
|
|
|
50
53
|
try:
|
|
51
54
|
self.settings.update(doc["commitizen"])
|
|
52
55
|
except (KeyError, TypeError):
|
|
53
|
-
|
|
56
|
+
pass
|
|
54
57
|
|
|
55
58
|
def set_key(self, key: str, value: object) -> Self:
|
|
56
59
|
with open(self.path, "rb") as yaml_file:
|
|
@@ -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=
|
|
3
|
+
commitizen/__version__.py,sha256=eI5KkHEFD5jz0OTYWOVaCxYxX1UbP8_xHAIvX8O5ugE,23
|
|
4
4
|
commitizen/bump.py,sha256=-C09y5sAlVPyWTbEgqZimQMlz6LL248Ht2Pv90Ks6Dg,4692
|
|
5
5
|
commitizen/changelog.py,sha256=ydaFUSHUBPpdNjw_yoPJ1_pr3AAr9rHS-NwP8gQDIUA,11278
|
|
6
6
|
commitizen/changelog_formats/__init__.py,sha256=ZkxdmGybxWTzQZbt5KTJdAdbdKx0-v3aXtNDC-efRQk,3369
|
|
@@ -22,12 +22,12 @@ commitizen/commands/init.py,sha256=doLc-Y_o89S-64j-c7P4_ID0EiaAkhhe5veZpH8V8Ew,1
|
|
|
22
22
|
commitizen/commands/list_cz.py,sha256=0eCGpRLn5v7XLNWiMkA14QN260fyR6gzoDvAM2mq-IM,349
|
|
23
23
|
commitizen/commands/schema.py,sha256=66m_xCjAsUS7_a2Q_dx-CCiHJ6UXG8RJVUeLO_pl2gU,366
|
|
24
24
|
commitizen/commands/version.py,sha256=X_Hrjb_48hBGTN3J8dD3_kveLvaPBlnQarw96Koag20,2868
|
|
25
|
-
commitizen/config/__init__.py,sha256=
|
|
26
|
-
commitizen/config/base_config.py,sha256=
|
|
25
|
+
commitizen/config/__init__.py,sha256=aMfdqszk20Rm9Y5W9G3ZE_FGA5d4tcKK2xdRSgtZ8sI,1806
|
|
26
|
+
commitizen/config/base_config.py,sha256=mWb39DMd5J7yn2Nj-6ZFbUZeR4Tapr06KPvyMXRenhE,1659
|
|
27
27
|
commitizen/config/factory.py,sha256=-6TcsKLGVJ1Tw1nkRVv5aAfS4JvxY6V2QLirNL8Ly8M,839
|
|
28
|
-
commitizen/config/json_config.py,sha256=
|
|
29
|
-
commitizen/config/toml_config.py,sha256=
|
|
30
|
-
commitizen/config/yaml_config.py,sha256=
|
|
28
|
+
commitizen/config/json_config.py,sha256=fyMFxZIvQcKNSJUa56kus9vhXQKoA5MTWl9FZY1KyvU,1948
|
|
29
|
+
commitizen/config/toml_config.py,sha256=aoT6nsTSv2AEQdbKfqNOL7sj78hr9QESdX9BxHgipzY,2395
|
|
30
|
+
commitizen/config/yaml_config.py,sha256=hmH0_DU-lpbtmFJU5cMirNt2WAr3oBuqkMAbIKy5oU8,2043
|
|
31
31
|
commitizen/cz/__init__.py,sha256=45-VfzHalISUDcpkrfGLVvBRoTdAtdTf3-CmuOqBaus,1311
|
|
32
32
|
commitizen/cz/base.py,sha256=w2VeKICv59VBgOxpRB8VaXN5LoJRop_P6mDDkrTsQe0,5540
|
|
33
33
|
commitizen/cz/conventional_commits/__init__.py,sha256=GZHCs25rv1p1dp4BNczL5FU_pPdENazF8yso_Ca2sQQ,70
|
|
@@ -66,7 +66,7 @@ commitizen/templates/CHANGELOG.md.j2,sha256=MggRrhbL3EabwsH8v0oFMM8G296ATBzePaqu
|
|
|
66
66
|
commitizen/templates/CHANGELOG.rst.j2,sha256=XHh4a7S83Z5Vrd_0UaLDA1Bb7A82Px4eHcbHsZGKYF8,515
|
|
67
67
|
commitizen/templates/CHANGELOG.textile.j2,sha256=8JxCcDdgQUmNPxXFEv5IpbP_vcfvYCo5CSicNCZmFCY,404
|
|
68
68
|
commitizen/version_schemes.py,sha256=NDyxMzJGK1NKkTgtJ4BNw_NgKxJhvK0EWWVhfqzzwHI,13460
|
|
69
|
-
commitizen-4.13.
|
|
70
|
-
commitizen-4.13.
|
|
71
|
-
commitizen-4.13.
|
|
72
|
-
commitizen-4.13.
|
|
69
|
+
commitizen-4.13.1.dist-info/WHEEL,sha256=fAguSjoiATBe7TNBkJwOjyL1Tt4wwiaQGtNtjRPNMQA,80
|
|
70
|
+
commitizen-4.13.1.dist-info/entry_points.txt,sha256=EpbOUAABRQCFhf2HFcmrJZLGsbB_MSJ-tFua-NxUCxE,1085
|
|
71
|
+
commitizen-4.13.1.dist-info/METADATA,sha256=IGoTkaDPxQujlMdF_uMmma7zPK804jSqdYXkytflhCE,13532
|
|
72
|
+
commitizen-4.13.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|