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
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_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
358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 |
|
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
295 296 297 298 299 300 301 302 303 304 |
|
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
284 285 286 287 288 289 290 291 292 293 |
|
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
270 271 272 273 274 275 276 277 278 279 280 281 282 |
|
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
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 |
|
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
125 126 127 128 129 130 131 |
|
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
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 |
|
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
193 194 195 196 197 198 199 200 201 202 203 |
|
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
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_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
358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 |
|