Skip to content

Commit 2bd7634

Browse files
committed
Changed and standardized to term 'summary'
1 parent 5b1e921 commit 2bd7634

7 files changed

Lines changed: 24 additions & 24 deletions

File tree

.changelog-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ starting_tag_pipeline:
99
pattern: (?im)^## (?P<rev>\d+\.\d+(?:\.\d+)?)\s+\(\d+-\d{2}-\d{2}\)$
1010
named_subgroup: rev
1111
unreleased_label: Unreleased
12-
subject_pipeline:
12+
summary_pipeline:
1313
- action: strip_spaces
1414
- action: Strip
1515
comment: Get rid of any periods so we don't get double periods

generate_changelog/configuration.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
},
7171
]
7272

73-
DEFAULT_SUBJECT_PIPELINE = [
73+
DEFAULT_SUMMARY_PIPELINE = [
7474
{"action": "strip_spaces"},
7575
{
7676
"action": "Strip",
@@ -117,8 +117,8 @@ class Configuration:
117117
unreleased_label: str = "Unreleased"
118118
"""Used as the section title of the changes since the last valid tag."""
119119

120-
subject_pipeline: list = field(default_factory=list)
121-
"""Process the commit's subject for use in the changelog."""
120+
summary_pipeline: list = field(default_factory=list)
121+
"""Process the commit's first line for use in the changelog."""
122122

123123
body_pipeline: list = field(default_factory=list)
124124
"""Process the commit's body for use in the changelog."""
@@ -186,7 +186,7 @@ def get_default_config() -> Configuration:
186186
ignore_patterns=DEFAULT_IGNORE_PATTERNS,
187187
section_patterns=DEFAULT_SECTION_PATTERNS,
188188
body_pipeline=DEFAULT_BODY_PIPELINE,
189-
subject_pipeline=DEFAULT_SUBJECT_PIPELINE,
189+
summary_pipeline=DEFAULT_SUMMARY_PIPELINE,
190190
starting_tag_pipeline=DEFAULT_STARTING_TAG_PIPELINE,
191191
output_pipeline=DEFAULT_OUTPUT_PIPELINE,
192192
valid_author_tokens=DEFAULT_VALID_AUTHOR_TOKENS,

generate_changelog/git_ops.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
"""git information access."""
22

3-
from typing import List, Optional
3+
from typing import List, Optional, Union
44

55
import datetime
66
import os
77
import re
88
from dataclasses import dataclass
99

10-
from git import Repo
10+
from git import Actor, Repo
1111

1212
from generate_changelog.configuration import get_config
1313

@@ -19,7 +19,7 @@
1919
"author_date_timestamp": "%at",
2020
"committer_name": "%cn",
2121
"committer_date_timestamp": "%ct",
22-
"subject": "%s",
22+
"summary": "%s",
2323
"body": "%b",
2424
}
2525
GIT_FULL_FORMAT_STRING = "%x00".join(GIT_FORMAT_KEYS.values()) + "%x1F"
@@ -31,7 +31,7 @@ class TagInfo:
3131

3232
name: str
3333
commit: str
34-
tagger: str
34+
tagger: Union[str, Actor]
3535
tagged_datetime: datetime.datetime
3636

3737
@property

generate_changelog/templates/commit.md.jinja

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
- {{ commit.subject }}
1+
- {{ commit.summary }}
22
{{ commit.body|indent(2, first=True) }}
33
{% for key, val in commit.metadata["trailers"].items() %}
44
{% if key not in VALID_AUTHOR_TOKENS %}

generate_changelog/templating.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,12 @@ def get_context_from_tags(
6060
continue
6161

6262
commit_metadata_func = MetadataCollector()
63-
subject_pipeline = pipeline_factory(
64-
action_list=get_config().subject_pipeline,
63+
summary_pipeline = pipeline_factory(
64+
action_list=get_config().summary_pipeline,
6565
commit_metadata_func=commit_metadata_func,
6666
version_metadata_func=version_metadata_func,
6767
)
68-
subject = subject_pipeline.run(commit.summary)
68+
summary = summary_pipeline.run(commit.summary)
6969
body_pipeline = pipeline_factory(
7070
action_list=get_config().body_pipeline,
7171
commit_metadata_func=commit_metadata_func,
@@ -80,7 +80,7 @@ def get_context_from_tags(
8080
sha=commit.hexsha,
8181
commit_datetime=commit.committed_datetime,
8282
committer=f"{commit.committer.name} <{commit.committer.email}>",
83-
subject=subject,
83+
summary=summary,
8484
body=body,
8585
metadata=commit_metadata_func.metadata.copy(),
8686
)
@@ -128,9 +128,9 @@ def render(repository: Repo, config: Configuration, starting_tag: Optional[str]
128128
The full or partial changelog
129129
"""
130130
version_context = get_context_from_tags(repository, config, starting_tag)
131-
context = get_config().variables.copy()
131+
context = config.variables.copy()
132132
context["versions"] = version_context
133-
context["VALID_AUTHOR_TOKENS"] = get_config().valid_author_tokens
133+
context["VALID_AUTHOR_TOKENS"] = config.valid_author_tokens
134134

135135
if starting_tag:
136136
heading_str = default_env.get_template("heading.md.jinja").render()

test/test_log_linearity.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,12 @@ def test_tags_on_multiple_branches(bare_git_repo, capsys):
8282
ver001 = context[4]
8383
assert len(unreleased.sections) == 0
8484
assert len(ver004.sections[0].commits) == 3
85-
assert ver004.sections[0].commits[0].subject == "Commit 5 on master."
86-
assert ver004.sections[0].commits[1].subject == "Commit 3 on develop."
87-
assert ver004.sections[0].commits[2].subject == "Commit 2 on develop."
85+
assert ver004.sections[0].commits[0].summary == "Commit 5 on master."
86+
assert ver004.sections[0].commits[1].summary == "Commit 3 on develop."
87+
assert ver004.sections[0].commits[2].summary == "Commit 2 on develop."
8888
assert len(ver003.sections[0].commits) == 1
89-
assert ver003.sections[0].commits[0].subject == "Commit 4 on master."
89+
assert ver003.sections[0].commits[0].summary == "Commit 4 on master."
9090
assert len(ver002.sections[0].commits) == 1
91-
assert ver002.sections[0].commits[0].subject == "Commit 2 on develop."
91+
assert ver002.sections[0].commits[0].summary == "Commit 2 on develop."
9292
assert len(ver001.sections[0].commits) == 1
93-
assert ver001.sections[0].commits[0].subject == "Commit 1 on master."
93+
assert ver001.sections[0].commits[0].summary == "Commit 1 on master."

test/test_templating.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def test_commit_context():
4444
sha=commit.hexsha,
4545
commit_datetime=commit.committed_datetime,
4646
committer=f"{commit.committer.name} <{commit.committer.email}>",
47-
subject=commit.summary,
47+
summary=commit.summary,
4848
body="\n".join(commit.message.splitlines()[1:]),
4949
)
5050
assert commit.hexsha[:7] == context.short_sha
@@ -61,7 +61,7 @@ def test_commit_with_no_email():
6161
sha=commit.hexsha,
6262
commit_datetime=commit.committed_datetime,
6363
committer=f"{commit.committer.name} <{commit.committer.email}>",
64-
subject=commit.summary,
64+
summary=commit.summary,
6565
body="\n".join(commit.message.splitlines()[1:]),
6666
metadata={"trailers": {"co-authored-by": [name_only]}},
6767
)

0 commit comments

Comments
 (0)