MCPcopy Index your code
hub / github.com/commitizen-tools/commitizen / __init__

Method __init__

commitizen/commands/changelog.py:52–129  ·  view source on GitHub ↗
(self, config: BaseConfig, arguments: ChangelogArgs)

Source from the content-addressed store, hash-verified

50 """Generate a changelog based on the commit history."""
51
52 def __init__(self, config: BaseConfig, arguments: ChangelogArgs) -> None:
53 if not git.is_git_project():
54 raise NotAGitProjectError()
55
56 self.config = config
57
58 changelog_file_name = arguments.get("file_name") or self.config.settings.get(
59 "changelog_file"
60 )
61 if not isinstance(changelog_file_name, str):
62 raise NotAllowed(
63 "Changelog file name is broken.\n"
64 "Check the flag `--file-name` in the terminal "
65 f"or the setting `changelog_file` in {self.config.path}"
66 )
67 self.file_name = (
68 Path(self.config.path.parent, changelog_file_name).as_posix()
69 if self.config.path is not None
70 else changelog_file_name
71 )
72
73 self.cz = factory.committer_factory(self.config)
74
75 self.start_rev = arguments.get("start_rev") or self.config.settings.get(
76 "changelog_start_rev"
77 )
78
79 self.changelog_format = get_changelog_format(self.config, self.file_name)
80
81 self.incremental = bool(
82 arguments.get("incremental")
83 or self.config.settings.get("changelog_incremental")
84 )
85 self.dry_run = bool(arguments.get("dry_run"))
86
87 self.scheme = get_version_scheme(
88 self.config.settings, arguments.get("version_scheme")
89 )
90
91 current_version = (
92 arguments.get("current_version")
93 or self.config.settings.get("version")
94 or ""
95 )
96 self.current_version = self.scheme(current_version) if current_version else None
97
98 self.unreleased_version = arguments["unreleased_version"]
99 self.change_type_map = (
100 self.config.settings.get("change_type_map") or self.cz.change_type_map
101 )
102 self.change_type_order = cast(
103 "list[str]",
104 self.config.settings.get("change_type_order")
105 or self.cz.change_type_order
106 or defaults.CHANGE_TYPE_ORDER,
107 )
108 self.rev_range = arguments.get("rev_range")
109 self.tag_rules = TagRules(

Callers

nothing calls this directly

Calls 7

NotAGitProjectErrorClass · 0.90
NotAllowedClass · 0.90
get_changelog_formatFunction · 0.90
get_version_schemeFunction · 0.90
TagRulesClass · 0.90
getMethod · 0.45
schemeMethod · 0.45

Tested by

no test coverage detected