forked from commitizen-tools/commitizen
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdefaults.py
More file actions
116 lines (103 loc) · 3.25 KB
/
Copy pathdefaults.py
File metadata and controls
116 lines (103 loc) · 3.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
import pathlib
import sys
from collections import OrderedDict
from typing import Any, Dict, Iterable, List, MutableMapping, Optional, Tuple, Union
if sys.version_info < (3, 8):
from typing_extensions import TypedDict
else:
from typing import TypedDict
# Type
Questions = Iterable[MutableMapping[str, Any]]
class CzSettings(TypedDict, total=False):
bump_pattern: str
bump_map: "OrderedDict[str, str]"
bump_map_major_version_zero: "OrderedDict[str, str]"
change_type_order: List[str]
questions: Questions
example: Optional[str]
schema_pattern: Optional[str]
schema: Optional[str]
info_path: Union[str, pathlib.Path]
info: str
message_template: str
commit_parser: Optional[str]
changelog_pattern: Optional[str]
change_type_map: Optional[Dict[str, str]]
class Settings(TypedDict, total=False):
name: str
version: Optional[str]
version_files: List[str]
version_provider: Optional[str]
tag_format: str
bump_message: Optional[str]
allow_abort: bool
changelog_file: str
changelog_incremental: bool
changelog_start_rev: Optional[str]
changelog_merge_prerelease: bool
update_changelog_on_bump: bool
use_shortcuts: bool
style: Optional[List[Tuple[str, str]]]
customize: CzSettings
major_version_zero: bool
pre_bump_hooks: Optional[List[str]]
post_bump_hooks: Optional[List[str]]
prerelease_offset: int
version_type: Optional[str]
name: str = "cz_conventional_commits"
config_files: List[str] = [
"pyproject.toml",
".cz.toml",
".cz.json",
"cz.json",
".cz.yaml",
"cz.yaml",
]
DEFAULT_SETTINGS: Settings = {
"name": "cz_conventional_commits",
"version": None,
"version_files": [],
"version_provider": "commitizen",
"tag_format": "$version", # example v$version
"bump_message": None, # bumped v$current_version to $new_version
"allow_abort": False,
"changelog_file": "CHANGELOG.md",
"changelog_incremental": False,
"changelog_start_rev": None,
"changelog_merge_prerelease": False,
"update_changelog_on_bump": False,
"use_shortcuts": False,
"major_version_zero": False,
"pre_bump_hooks": [],
"post_bump_hooks": [],
"prerelease_offset": 0,
"version_type": None,
}
MAJOR = "MAJOR"
MINOR = "MINOR"
PATCH = "PATCH"
bump_pattern = r"^(((BREAKING[\-\ ]CHANGE|feat|fix|refactor|perf)(\(.+\))?(!)?)|\w+!):"
bump_map = OrderedDict(
(
(r"^.+!$", MAJOR),
(r"^BREAKING[\-\ ]CHANGE", MAJOR),
(r"^feat", MINOR),
(r"^fix", PATCH),
(r"^refactor", PATCH),
(r"^perf", PATCH),
)
)
bump_map_major_version_zero = OrderedDict(
(
(r"^.+!$", MINOR),
(r"^BREAKING[\-\ ]CHANGE", MINOR),
(r"^feat", MINOR),
(r"^fix", PATCH),
(r"^refactor", PATCH),
(r"^perf", PATCH),
)
)
change_type_order = ["BREAKING CHANGE", "Feat", "Fix", "Refactor", "Perf"]
bump_message = "bump: version $current_version → $new_version"
commit_parser = r"^((?P<change_type>feat|fix|refactor|perf|BREAKING CHANGE)(?:\((?P<scope>[^()\r\n]*)\)|\()?(?P<breaking>!)?|\w+!):\s(?P<message>.*)?" # noqa
version_parser = r"(?P<version>([0-9]+)\.([0-9]+)\.([0-9]+)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-]+)?(\w+)?)"