| 161 | return bump.find_increment(commits, regex=bump_pattern, increments_map=bump_map) |
| 162 | |
| 163 | def _validate_arguments(self, current_version: VersionProtocol) -> None: |
| 164 | errors: list[str] = [] |
| 165 | if self.arguments["manual_version"]: |
| 166 | for val, option in ( |
| 167 | (self.arguments["increment"], "--increment"), |
| 168 | (self.arguments["prerelease"], "--prerelease"), |
| 169 | (self.arguments["devrelease"] is not None, "--devrelease"), |
| 170 | (self.arguments["local_version"], "--local-version"), |
| 171 | (self.arguments["build_metadata"], "--build-metadata"), |
| 172 | (self.arguments["major_version_zero"], "--major-version-zero"), |
| 173 | ): |
| 174 | if val: |
| 175 | errors.append(f"{option} cannot be combined with MANUAL_VERSION") |
| 176 | |
| 177 | if self.arguments["major_version_zero"] and current_version.release[0]: |
| 178 | errors.append( |
| 179 | f"--major-version-zero is meaningless for current version {current_version}" |
| 180 | ) |
| 181 | if self.arguments["build_metadata"] and self.arguments["local_version"]: |
| 182 | errors.append("--local-version cannot be combined with --build-metadata") |
| 183 | |
| 184 | if errors: |
| 185 | raise NotAllowed("\n".join(errors)) |
| 186 | |
| 187 | def _resolve_increment_and_new_version( |
| 188 | self, current_version: VersionProtocol, current_tag: git.GitTag | None |