Skip to content

Commit

Permalink
Merge pull request #320 from lukas-code/missing-nightly
Browse files Browse the repository at this point in the history
fix getting working commit with missing nightlies
  • Loading branch information
ehuss authored Feb 28, 2024
2 parents e61eb10 + 0a8f5dc commit 9411af3
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
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

0 comments on commit 9411af3

Please sign in to comment.