Skip to content

commits

Filter and process commits into contexts.

FUNCTION DESCRIPTION
create_version_context

Generate a VersionContext from a tag dictionary.

first_matching

Return the first section that matches the given commit summary.

generate_commit_context

Create the renderable context for this commit.

get_context_from_tags

Generate the template context from git tags.

sort_group_commits

Sort the commit groups and convert the dict into a list of GroupingContext objects.

Classes

Functions

create_version_context

create_version_context(config: Configuration, tag: GitTag) -> VersionContext

Generate a VersionContext from a tag dictionary.

PARAMETER DESCRIPTION
config

The current configuration object.

TYPE: Configuration

tag

A GitTag used as the basis for a VersionContext

TYPE: GitTag

RETURNS DESCRIPTION
VersionContext

The finished version context.

first_matching

first_matching(actions: list, commit: CommitContext) -> Optional[str]

Return the first section that matches the given commit summary.

PARAMETER DESCRIPTION
actions

A mapping of section names to a list of regular expressions for matching.

TYPE: list

commit

The commit context to evaluate

TYPE: CommitContext

RETURNS DESCRIPTION
Optional[str]

The name of the section.

generate_commit_context

generate_commit_context(
    commit: Commit,
    config: Configuration,
    version_metadata_func: Optional[Callable],
) -> CommitContext

Create the renderable context for this commit.

The summary and body are processed through their pipelines, and a category is assigned.

PARAMETER DESCRIPTION
commit

The original commit data

TYPE: Commit

config

The configuration to use

TYPE: Configuration

version_metadata_func

An optional callable to set version metadata while processing

TYPE: Optional[Callable]

RETURNS DESCRIPTION
CommitContext

The render-able commit context

get_context_from_tags

get_context_from_tags(
    repository: Repo, config: Configuration, starting_tag: Optional[str] = None
) -> List[VersionContext]

Generate the template context from git tags.

PARAMETER DESCRIPTION
repository

The git repository to evaluate.

TYPE: Repo

config

The current configuration object.

TYPE: Configuration

starting_tag

Optional starting tag for generating incremental changelogs.

TYPE: Optional[str] DEFAULT: None

RETURNS DESCRIPTION
List[VersionContext]

A list of VersionContext objects.

sort_group_commits

sort_group_commits(commit_groups: dict) -> list[GroupingContext]

Sort the commit groups and convert the dict into a list of GroupingContext objects.

PARAMETER DESCRIPTION
commit_groups

A dict where the keys are grouping values.

TYPE: dict

RETURNS DESCRIPTION
list[GroupingContext]

A list of GroupingContext objects.