Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix some bugs in the script #169

Merged
merged 1 commit into from
Jan 20, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 18 additions & 6 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,14 @@ fn main() {
let version = args
.next()
.expect("A version number (xx.yy.zz) for the Rust release is required.");
let today = Utc::now().date();
let today = Utc::now().date_naive();

// A known rust release date. (1.42.0)
let mut end = Utc.ymd(2020, 3, 12);
let mut end = Utc
.with_ymd_and_hms(2020, 3, 12, 0, 0, 0)
.single()
.unwrap()
.date_naive();
let six_weeks = Duration::weeks(6);

// Get the most recent rust release date.
Expand Down Expand Up @@ -126,17 +130,20 @@ fn main() {
}

eprintln!(
"Did not use {:?} from {} <{}>",
"Did not use {:?} from {} <{}> (intended to provide relnotes for: {:?})",
section,
issue.raw["title"].as_str().unwrap(),
issue.raw["url"].as_str().unwrap()
issue.raw["url"].as_str().unwrap(),
issues
.iter()
.find(|i| i["number"].as_u64().unwrap() == issue.for_number)
);
}
}

let relnotes = ReleaseNotes {
version,
date: (end + six_weeks).naive_utc(),
date: end + six_weeks,

language_relnotes,
compiler_relnotes,
Expand Down Expand Up @@ -282,6 +289,7 @@ struct TrackingIssues {

#[derive(Debug)]
struct TrackingIssue {
for_number: u64,
raw: json::Value,
// Section name -> (used, lines)
sections: HashMap<String, (bool, Vec<String>)>,
Expand Down Expand Up @@ -331,6 +339,7 @@ impl TrackingIssues {
tracking_issues.insert(
for_number,
TrackingIssue {
for_number,
raw: o.clone(),
sections,
},
Expand Down Expand Up @@ -362,7 +371,10 @@ fn map_to_line_items<'a>(
}

for (section, (used, lines)) in issue.sections.iter_mut() {
if let Some(contents) = by_section.get_mut(section.as_str()) {
if let Some((_, contents)) = by_section
.iter_mut()
.find(|(s, _)| s.eq_ignore_ascii_case(section))
{
*used = true;
for line in lines.iter() {
contents.push_str(line);
Expand Down
Loading