@@ -115,18 +115,22 @@ def print_section(crate: str, items: List[str]) -> None:
115
115
print ()
116
116
117
117
118
+ def changelog_filepath (crate : str ) -> str :
119
+ scripts_dirpath = os .path .dirname (os .path .realpath (__file__ ))
120
+ if crate == "egui" :
121
+ file_path = f"{ scripts_dirpath } /../CHANGELOG.md"
122
+ else :
123
+ file_path = f"{ scripts_dirpath } /../crates/{ crate } /CHANGELOG.md"
124
+ return os .path .normpath (file_path )
125
+
126
+
118
127
def add_to_changelog_file (crate : str , items : List [str ], version : str ) -> None :
119
128
insert_text = f"\n ## { version } - { date .today ()} \n "
120
129
for item in items :
121
130
insert_text += f"* { item } \n "
122
131
insert_text += "\n "
123
132
124
- scripts_dirpath = os .path .dirname (os .path .realpath (__file__ ))
125
- if crate == "egui" :
126
- file_path = f"{ scripts_dirpath } /../CHANGELOG.md"
127
- else :
128
- file_path = f"{ scripts_dirpath } /../crates/{ crate } /CHANGELOG.md"
129
- file_path = os .path .normpath (file_path )
133
+ file_path = changelog_filepath (crate )
130
134
131
135
with open (file_path , 'r' ) as file :
132
136
content = file .read ()
@@ -151,6 +155,28 @@ def main() -> None:
151
155
print ("ERROR: --version is required when --write is used" )
152
156
sys .exit (1 )
153
157
158
+ crate_names = [
159
+ "ecolor" ,
160
+ "eframe" ,
161
+ "egui_extras" ,
162
+ "egui_plot" ,
163
+ "egui_glow" ,
164
+ "egui-wgpu" ,
165
+ "egui-winit" ,
166
+ "egui" ,
167
+ "epaint" ,
168
+ ]
169
+
170
+ # We read all existing changelogs to remove duplicate entries.
171
+ # For instance: the PRs that were part of 0.27.2 would also show up in the diff for `0.27.0..HEAD`
172
+ # when its time for a 0.28 release. We can't do `0.27.2..HEAD` because we would miss PRs that were
173
+ # merged before in `0.27.0..0.27.2` that were not cherry-picked into `0.27.2`.
174
+ all_changelogs = ""
175
+ for crate in crate_names :
176
+ file_path = changelog_filepath (crate )
177
+ with open (file_path , 'r' ) as file :
178
+ all_changelogs += file .read ()
179
+
154
180
repo = Repo ("." )
155
181
commits = list (repo .iter_commits (args .commit_range ))
156
182
commits .reverse () # Most recent last
@@ -167,17 +193,6 @@ def main() -> None:
167
193
168
194
ignore_labels = ["CI" , "dependencies" ]
169
195
170
- crate_names = [
171
- "ecolor" ,
172
- "eframe" ,
173
- "egui_extras" ,
174
- "egui_plot" ,
175
- "egui_glow" ,
176
- "egui-wgpu" ,
177
- "egui-winit" ,
178
- "egui" ,
179
- "epaint" ,
180
- ]
181
196
sections = {}
182
197
unsorted_prs = []
183
198
unsorted_commits = []
@@ -193,6 +208,10 @@ def main() -> None:
193
208
summary = f"{ title } [{ hexsha [:7 ]} ](https://github.com/{ OWNER } /{ REPO } /commit/{ hexsha } )"
194
209
unsorted_commits .append (summary )
195
210
else :
211
+ if f"[#{ pr_number } ]" in all_changelogs :
212
+ print (f"Ignoring PR that is already in the changelog: #{ pr_number } " )
213
+ continue
214
+
196
215
# We prefer the PR title if available
197
216
title = pr_info .pr_title if pr_info else title
198
217
labels = pr_info .labels if pr_info else []
0 commit comments