From c6d3f651d9a0735ecbc5a278e7d8504e4d793cec Mon Sep 17 00:00:00 2001 From: Lukas Markeffsky <@> Date: Mon, 26 Feb 2024 15:24:50 +0100 Subject: [PATCH 1/2] fix getting working commit with missing nightlies --- src/main.rs | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/src/main.rs b/src/main.rs index 8a25dc2..8699039 100644 --- a/src/main.rs +++ b/src/main.rs @@ -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)] @@ -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::(), + 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 {}", From 0a8f5dc4f1570d6e5f2e44b33144aad334e04994 Mon Sep 17 00:00:00 2001 From: Lukas Markeffsky <@> Date: Mon, 26 Feb 2024 15:26:19 +0100 Subject: [PATCH 2/2] remove redundant import ``` warning: the item `reqwest` is imported redundantly --> src/github.rs:3:15 | 3 | use reqwest::{self, blocking::Client, blocking::Response}; | ^^^^ the item `reqwest` is already defined here | = note: `#[warn(unused_imports)]` on by default ``` --- src/github.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/github.rs b/src/github.rs index 5f11080..29f600e 100644 --- a/src/github.rs +++ b/src/github.rs @@ -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};