| 161 | return start_rev |
| 162 | |
| 163 | def _write_changelog( |
| 164 | self, changelog_out: str, lines: list[str], changelog_meta: changelog.Metadata |
| 165 | ) -> None: |
| 166 | with smart_open( |
| 167 | self.file_name, "w", encoding=self.config.settings["encoding"] |
| 168 | ) as changelog_file: |
| 169 | partial_changelog: str | None = None |
| 170 | if self.incremental: |
| 171 | new_lines = changelog.incremental_build( |
| 172 | changelog_out, lines, changelog_meta |
| 173 | ) |
| 174 | changelog_out = "".join(new_lines) |
| 175 | partial_changelog = changelog_out |
| 176 | |
| 177 | if self.cz.changelog_hook: |
| 178 | changelog_out = self.cz.changelog_hook(changelog_out, partial_changelog) |
| 179 | |
| 180 | changelog_file.write(changelog_out) |
| 181 | |
| 182 | def _export_template(self, dist: str) -> None: |
| 183 | filename = changelog.get_changelog_template( |