repomatic.mailmap moduleΒΆ

Group the contributor identities of the git history into a .mailmap.

Backs the sync-mailmap command: parses the existing mappings as the reference for identities already grouped, reads every author and committer the history holds, and appends whatever is not covered yet.

repomatic.mailmap.MAILMAP_PATH = PosixPath('.mailmap')ΒΆ

Canonical path to the .mailmap file in the repository root.

repomatic.mailmap.remove_header(content)[source]ΒΆ

Return content without the generated-by comment header and blank lines above.

Strips the metadata block sync-mailmap writes at the top of the file (generated_header output: # Generated by … and # Timestamp: … lines), so a re-run parses only the identity mappings.

Return type:

str

class repomatic.mailmap.Record(canonical='', aliases=<factory>, pre_comment='')[source]ΒΆ

Bases: object

A mailmap identity mapping entry.

canonical: str = ''ΒΆ
aliases: set[str]ΒΆ
pre_comment: str = ''ΒΆ
class repomatic.mailmap.Mailmap[source]ΒΆ

Bases: object

Helpers to manipulate .mailmap files.

.mailmap file format is documented on Git website.

Initialize the mailmap with an empty list of records.

records: list[Record]ΒΆ
static split_identities(mapping)[source]ΒΆ

Split a mapping of identities and normalize them.

Return type:

tuple[str, set[str]]

parse(content)[source]ΒΆ

Parse mailmap content and add it to the current list of records.

Each non-empty, non-comment line is considered a mapping entry.

The preceding lines of a mapping entry are kept attached to it as pre-comments, so the layout will be preserved on rendering, during which records are sorted.

Return type:

None

find(identity)[source]ΒΆ

Returns True if the provided identity matched any record.

Return type:

bool

property git_contributors: set[str][source]ΒΆ

Returns the set of all contributors found in the Git commit history.

No normalization happens: all variations of authors and committers strings attached to all commits are considered. A failing git invocation raises through the CLI framework, which prints git’s stderr and exits non-zero without a property ever terminating the process itself.

update_from_git()[source]ΒΆ

Add to internal records all missing contributors found in commit history.

This method will refrain from adding contributors already registered as aliases.

Return type:

None

render()[source]ΒΆ

Render internal records in Mailmap format.

Return type:

str