@@ -796,24 +796,50 @@ fn install(cfg: &Config, client: &Client, bound: &Bound) -> Result<(), Error> {
796796}
797797
798798fn bisect ( cfg : & Config , client : & Client ) -> Result < ( ) , Error > {
799+ if cfg. is_commit {
800+ let bisection_result = bisect_ci ( & cfg, & client) ?;
801+ print_results ( cfg, client, & bisection_result) ;
802+ } else {
803+ let bisection_result = bisect_nightlies ( & cfg, & client) ?;
804+ print_results ( cfg, client, & bisection_result) ;
805+ let regression = & bisection_result. searched [ bisection_result. found ] ;
806+
807+ if let ToolchainSpec :: Nightly { date } = regression. spec {
808+ let previous_date = date - chrono:: Duration :: days ( 1 ) ;
809+
810+ if let Bound :: Commit ( regression_commit) = Bound :: Date ( date) . as_commit ( ) ? {
811+ if let Bound :: Commit ( working_commit) = Bound :: Date ( previous_date) . as_commit ( ) ? {
812+ eprintln ! (
813+ "looking for regression commit between {} and {}" ,
814+ date. format( "%Y-%m-%d" ) ,
815+ previous_date. format( "%Y-%m-%d" ) ,
816+ ) ;
817+
818+ let bisection_result = bisect_ci_between ( cfg, client, & working_commit, & regression_commit) ?;
819+ print_results ( cfg, client, & bisection_result) ;
820+ }
821+ }
822+ }
823+ }
824+
825+ Ok ( ( ) )
826+ }
827+
828+ fn print_results ( cfg : & Config , client : & Client , bisection_result : & BisectionResult ) {
799829 let BisectionResult {
800830 searched : toolchains,
801831 dl_spec,
802832 found,
803- } = if cfg. is_commit {
804- bisect_ci ( & cfg, & client) ?
805- } else {
806- bisect_nightlies ( & cfg, & client) ?
807- } ;
833+ } = bisection_result;
808834
809835 eprintln ! (
810836 "searched toolchains {} through {}" ,
811837 toolchains. first( ) . unwrap( ) ,
812838 toolchains. last( ) . unwrap( ) ,
813839 ) ;
814840
815- if toolchains[ found] == * toolchains. last ( ) . unwrap ( ) {
816- let t = & toolchains[ found] ;
841+ if toolchains[ * found] == * toolchains. last ( ) . unwrap ( ) {
842+ let t = & toolchains[ * found] ;
817843 let r = match t. install ( & client, & dl_spec) {
818844 Ok ( ( ) ) => {
819845 let outcome = t. test ( & cfg) ;
@@ -835,14 +861,12 @@ fn bisect(cfg: &Config, client: &Client) -> Result<(), Error> {
835861 Satisfies :: Yes => { }
836862 Satisfies :: No | Satisfies :: Unknown => {
837863 eprintln ! ( "error: The regression was not found. Expanding the bounds may help." ) ;
838- return Ok ( ( ) ) ;
864+ return ;
839865 }
840866 }
841867 }
842868
843- eprintln ! ( "regression in {}" , toolchains[ found] ) ;
844-
845- Ok ( ( ) )
869+ eprintln ! ( "regression in {}" , toolchains[ * found] ) ;
846870}
847871
848872struct NightlyFinderIter {
@@ -1058,7 +1082,6 @@ fn toolchains_between(cfg: &Config, a: ToolchainSpec, b: ToolchainSpec) -> Vec<T
10581082
10591083fn bisect_ci ( cfg : & Config , client : & Client ) -> Result < BisectionResult , Error > {
10601084 eprintln ! ( "bisecting ci builds" ) ;
1061- let dl_spec = DownloadParams :: for_ci ( cfg) ;
10621085 let start = if let Some ( Bound :: Commit ( ref sha) ) = cfg. args . start {
10631086 sha
10641087 } else {
@@ -1073,6 +1096,11 @@ fn bisect_ci(cfg: &Config, client: &Client) -> Result<BisectionResult, Error> {
10731096
10741097 eprintln ! ( "starting at {}, ending at {}" , start, end) ;
10751098
1099+ bisect_ci_between ( cfg, client, start, end)
1100+ }
1101+
1102+ fn bisect_ci_between ( cfg : & Config , client : & Client , start : & str , end : & str ) -> Result < BisectionResult , Error > {
1103+ let dl_spec = DownloadParams :: for_ci ( cfg) ;
10761104 let mut commits = get_commits ( start, end) ?;
10771105 let now = chrono:: Utc :: now ( ) ;
10781106 commits. retain ( |c| now. signed_duration_since ( c. date ) . num_days ( ) < 167 ) ;
0 commit comments