@@ -75,15 +75,15 @@ def get_commit_tag(commit: GitCommit, tags: list[GitTag]) -> GitTag | None:
75
75
76
76
77
77
def _get_release_info (
78
- current_tag_name : str ,
79
- current_tag_date : str ,
78
+ prev_tag_name : str ,
79
+ prev_tag_date : str ,
80
80
changes : dict [str | None , list ],
81
81
changelog_release_hook : ChangelogReleaseHook | None ,
82
82
commit_tag : GitTag | None ,
83
83
) -> dict [str , Any ]:
84
84
release = {
85
- "version" : current_tag_name ,
86
- "date" : current_tag_date ,
85
+ "version" : prev_tag_name ,
86
+ "date" : prev_tag_date ,
87
87
"changes" : changes ,
88
88
}
89
89
if changelog_release_hook :
@@ -108,41 +108,38 @@ def generate_tree_from_commits(
108
108
rules = rules or TagRules ()
109
109
110
110
used_tags : set [GitTag ] = set ()
111
- current_tag_name = unreleased_version or "Unreleased"
112
- current_tag_date = (
113
- date .today ().isoformat () if unreleased_version is not None else ""
114
- )
111
+ prev_tag_name = unreleased_version or "Unreleased"
112
+ prev_tag_date = date .today ().isoformat () if unreleased_version is not None else ""
115
113
116
114
# Check if the latest commit is not tagged
117
115
current_tag = get_commit_tag (commits [0 ], tags ) if commits else None
118
116
if current_tag is not None :
119
117
used_tags .add (current_tag )
120
118
if current_tag .name :
121
- current_tag_name = current_tag .name
122
- current_tag_date = current_tag .date
119
+ prev_tag_name = current_tag .name
120
+ prev_tag_date = current_tag .date
123
121
124
122
changes : defaultdict [str | None , list ] = defaultdict (list )
125
- commit_tag : GitTag | None = None
126
123
for commit in commits :
127
- commit_tag = get_commit_tag (commit , tags )
124
+ current_tag = get_commit_tag (commit , tags )
128
125
129
126
if (
130
- commit_tag
131
- and commit_tag not in used_tags
132
- and rules .include_in_changelog (commit_tag )
127
+ current_tag
128
+ and current_tag not in used_tags
129
+ and rules .include_in_changelog (current_tag )
133
130
):
134
- used_tags .add (commit_tag )
131
+ used_tags .add (current_tag )
135
132
136
133
yield _get_release_info (
137
- current_tag_name ,
138
- current_tag_date ,
134
+ prev_tag_name ,
135
+ prev_tag_date ,
139
136
changes ,
140
137
changelog_release_hook ,
141
- commit_tag ,
138
+ current_tag ,
142
139
)
143
140
144
- current_tag_name = commit_tag .name
145
- current_tag_date = commit_tag .date
141
+ prev_tag_name = current_tag .name
142
+ prev_tag_date = current_tag .date
146
143
changes = defaultdict (list )
147
144
148
145
if not pat .match (commit .message ):
@@ -171,11 +168,11 @@ def generate_tree_from_commits(
171
168
)
172
169
173
170
yield _get_release_info (
174
- current_tag_name ,
175
- current_tag_date ,
171
+ prev_tag_name ,
172
+ prev_tag_date ,
176
173
changes ,
177
174
changelog_release_hook ,
178
- commit_tag ,
175
+ current_tag ,
179
176
)
180
177
181
178
0 commit comments