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 getting working commit with missing nightlies #320

Merged
merged 2 commits into from
Feb 28, 2024
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion src/github.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use anyhow::{bail, Context};
use reqwest::header::{HeaderMap, HeaderValue, InvalidHeaderValue, AUTHORIZATION, USER_AGENT};
use reqwest::{self, blocking::Client, blocking::Response};
use reqwest::{blocking::Client, blocking::Response};
use serde::{Deserialize, Serialize};

use crate::{parse_to_naive_date, Commit, GitDate};
Expand Down
22 changes: 18 additions & 4 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ use crate::github::get_commit;
use crate::least_satisfying::{least_satisfying, Satisfies};
use crate::repo_access::{AccessViaGithub, AccessViaLocalGit, RustRepositoryAccessor};
use crate::toolchains::{
download_progress, parse_to_naive_date, DownloadParams, InstallError, TestOutcome, Toolchain,
ToolchainSpec, NIGHTLY_SERVER, YYYY_MM_DD,
download_progress, parse_to_naive_date, DownloadError, DownloadParams, InstallError,
TestOutcome, Toolchain, ToolchainSpec, NIGHTLY_SERVER, YYYY_MM_DD,
};

#[derive(Debug, Clone, PartialEq)]
Expand Down Expand Up @@ -603,9 +603,23 @@ impl Config {
&nightly_bisection_result.searched[nightly_bisection_result.found];

if let ToolchainSpec::Nightly { date } = nightly_regression.spec {
let previous_date = date.pred_opt().unwrap();
let mut previous_date = date.pred_opt().unwrap();
let working_commit = loop {
match Bound::Date(previous_date).sha() {
Ok(sha) => break sha,
Err(err)
if matches!(
err.downcast_ref::<DownloadError>(),
Some(DownloadError::NotFound(_)),
) =>
{
eprintln!("missing nightly for {}", previous_date.format(YYYY_MM_DD));
previous_date = previous_date.pred_opt().unwrap();
}
Err(err) => return Err(err),
}
};

let working_commit = Bound::Date(previous_date).sha()?;
let bad_commit = Bound::Date(date).sha()?;
eprintln!(
"looking for regression commit between {} and {}",
Expand Down