commit ¤
Module containing the commit logic.
Classes:
-
AngularConvention
–Angular commit message convention.
-
BasicConvention
–Basic commit message convention.
-
Commit
–A class to represent a commit.
-
CommitConvention
–A base class for a convention of commit messages.
-
ConventionalCommitConvention
–Conventional commit message convention.
AngularConvention ¤
Bases: CommitConvention
Angular commit message convention.
Methods:
-
is_major
–Tell if this commit is worth a major bump.
-
is_minor
–Tell if this commit is worth a minor bump.
-
parse_subject
–Parse the subject of the commit (
<type>[(scope)]: Subject
).
is_major ¤
Tell if this commit is worth a major bump.
Parameters:
-
commit_message
(str
) –The commit message.
Returns:
-
bool
–Whether it's a major commit.
Source code in src/git_changelog/commit.py
475 476 477 478 479 480 481 482 483 484 |
|
is_minor ¤
Tell if this commit is worth a minor bump.
Parameters:
-
commit_type
(str
) –The commit type.
Returns:
-
bool
–Whether it's a minor commit.
Source code in src/git_changelog/commit.py
464 465 466 467 468 469 470 471 472 473 |
|
parse_subject ¤
Parse the subject of the commit (<type>[(scope)]: Subject
).
Parameters:
-
commit_subject
(str
) –The commit message subject.
Returns:
Source code in src/git_changelog/commit.py
448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 |
|
BasicConvention ¤
Bases: CommitConvention
Basic commit message convention.
Methods:
-
is_major
–Tell if this commit is worth a major bump.
-
is_minor
–Tell if this commit is worth a minor bump.
-
parse_type
–Parse the type of the commit given its subject.
is_major ¤
Tell if this commit is worth a major bump.
Parameters:
-
commit_message
(str
) –The commit message.
Returns:
-
bool
–Whether it's a major commit.
Source code in src/git_changelog/commit.py
385 386 387 388 389 390 391 392 393 394 |
|
is_minor ¤
Tell if this commit is worth a minor bump.
Parameters:
-
commit_type
(str
) –The commit type.
Returns:
-
bool
–Whether it's a minor commit.
Source code in src/git_changelog/commit.py
374 375 376 377 378 379 380 381 382 383 |
|
parse_type ¤
Parse the type of the commit given its subject.
Parameters:
-
commit_subject
(str
) –The commit message subject.
Returns:
-
str
–The commit type.
Source code in src/git_changelog/commit.py
360 361 362 363 364 365 366 367 368 369 370 371 372 |
|
Commit ¤
Commit(
commit_hash: str,
author_name: str = "",
author_email: str = "",
author_date: str | datetime = "",
committer_name: str = "",
committer_email: str = "",
committer_date: str | datetime = "",
refs: str = "",
subject: str = "",
body: list[str] | None = None,
url: str = "",
*,
parse_trailers: bool = False,
parent_hashes: str | list[str] = "",
commits_map: dict[str, Commit] | None = None,
version_parser: (
Callable[[str], tuple[ParsedVersion, str]] | None
) = None
)
A class to represent a commit.
Parameters:
-
commit_hash
(str
) –The commit hash.
-
author_name
(str
, default:''
) –The author name.
-
author_email
(str
, default:''
) –The author email.
-
author_date
(str | datetime
, default:''
) –The authoring date (datetime or UTC timestamp).
-
committer_name
(str
, default:''
) –The committer name.
-
committer_email
(str
, default:''
) –The committer email.
-
committer_date
(str | datetime
, default:''
) –The committing date (datetime or UTC timestamp).
-
refs
(str
, default:''
) –The commit refs.
-
subject
(str
, default:''
) –The commit message subject.
-
body
(list[str] | None
, default:None
) –The commit message body.
-
url
(str
, default:''
) –The commit URL.
-
parse_trailers
(bool
, default:False
) –Whether to parse Git trailers.
Methods:
-
update_with_convention
–Apply the convention-parsed data to this commit.
-
update_with_provider
–Apply the provider-parsed data to this commit.
Attributes:
-
parent_commits
(list[Commit]
) –Parent commits of this commit.
Source code in src/git_changelog/commit.py
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 |
|
update_with_convention ¤
update_with_convention(
convention: CommitConvention,
) -> None
Apply the convention-parsed data to this commit.
Parameters:
-
convention
(CommitConvention
) –The convention to use.
Source code in src/git_changelog/commit.py
215 216 217 218 219 220 221 |
|
update_with_provider ¤
update_with_provider(
provider: ProviderRefParser, parse_refs: bool = True
) -> None
Apply the provider-parsed data to this commit.
Parameters:
-
provider
(ProviderRefParser
) –The provider to use.
-
parse_refs
(bool
, default:True
) –Whether to parse references for this provider.
Source code in src/git_changelog/commit.py
223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 |
|
CommitConvention ¤
Bases: ABC
A base class for a convention of commit messages.
Methods:
-
parse_commit
–Parse the commit to extract information.
parse_commit abstractmethod
¤
Parse the commit to extract information.
Parameters:
-
commit
(Commit
) –The commit to parse.
Returns:
Source code in src/git_changelog/commit.py
283 284 285 286 287 288 289 290 291 292 293 |
|
ConventionalCommitConvention ¤
Bases: AngularConvention
Conventional commit message convention.
Methods:
-
is_major
–Tell if this commit is worth a major bump.
-
is_minor
–Tell if this commit is worth a minor bump.
-
parse_subject
–Parse the subject of the commit (
<type>[(scope)]: Subject
).
is_major ¤
Tell if this commit is worth a major bump.
Parameters:
-
commit_message
(str
) –The commit message.
Returns:
-
bool
–Whether it's a major commit.
Source code in src/git_changelog/commit.py
475 476 477 478 479 480 481 482 483 484 |
|
is_minor ¤
Tell if this commit is worth a minor bump.
Parameters:
-
commit_type
(str
) –The commit type.
Returns:
-
bool
–Whether it's a minor commit.
Source code in src/git_changelog/commit.py
464 465 466 467 468 469 470 471 472 473 |
|
parse_subject ¤
Parse the subject of the commit (<type>[(scope)]: Subject
).
Parameters:
-
commit_subject
(str
) –The commit message subject.
Returns:
Source code in src/git_changelog/commit.py
448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 |
|