@@ -796,24 +796,50 @@ fn install(cfg: &Config, client: &Client, bound: &Bound) -> Result<(), Error> {
796
796
}
797
797
798
798
fn 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 ) {
799
829
let BisectionResult {
800
830
searched : toolchains,
801
831
dl_spec,
802
832
found,
803
- } = if cfg. is_commit {
804
- bisect_ci ( & cfg, & client) ?
805
- } else {
806
- bisect_nightlies ( & cfg, & client) ?
807
- } ;
833
+ } = bisection_result;
808
834
809
835
eprintln ! (
810
836
"searched toolchains {} through {}" ,
811
837
toolchains. first( ) . unwrap( ) ,
812
838
toolchains. last( ) . unwrap( ) ,
813
839
) ;
814
840
815
- if toolchains[ found] == * toolchains. last ( ) . unwrap ( ) {
816
- let t = & toolchains[ found] ;
841
+ if toolchains[ * found] == * toolchains. last ( ) . unwrap ( ) {
842
+ let t = & toolchains[ * found] ;
817
843
let r = match t. install ( & client, & dl_spec) {
818
844
Ok ( ( ) ) => {
819
845
let outcome = t. test ( & cfg) ;
@@ -835,14 +861,12 @@ fn bisect(cfg: &Config, client: &Client) -> Result<(), Error> {
835
861
Satisfies :: Yes => { }
836
862
Satisfies :: No | Satisfies :: Unknown => {
837
863
eprintln ! ( "error: The regression was not found. Expanding the bounds may help." ) ;
838
- return Ok ( ( ) ) ;
864
+ return ;
839
865
}
840
866
}
841
867
}
842
868
843
- eprintln ! ( "regression in {}" , toolchains[ found] ) ;
844
-
845
- Ok ( ( ) )
869
+ eprintln ! ( "regression in {}" , toolchains[ * found] ) ;
846
870
}
847
871
848
872
struct NightlyFinderIter {
@@ -1058,7 +1082,6 @@ fn toolchains_between(cfg: &Config, a: ToolchainSpec, b: ToolchainSpec) -> Vec<T
1058
1082
1059
1083
fn bisect_ci ( cfg : & Config , client : & Client ) -> Result < BisectionResult , Error > {
1060
1084
eprintln ! ( "bisecting ci builds" ) ;
1061
- let dl_spec = DownloadParams :: for_ci ( cfg) ;
1062
1085
let start = if let Some ( Bound :: Commit ( ref sha) ) = cfg. args . start {
1063
1086
sha
1064
1087
} else {
@@ -1073,6 +1096,11 @@ fn bisect_ci(cfg: &Config, client: &Client) -> Result<BisectionResult, Error> {
1073
1096
1074
1097
eprintln ! ( "starting at {}, ending at {}" , start, end) ;
1075
1098
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) ;
1076
1104
let mut commits = get_commits ( start, end) ?;
1077
1105
let now = chrono:: Utc :: now ( ) ;
1078
1106
commits. retain ( |c| now. signed_duration_since ( c. date ) . num_days ( ) < 167 ) ;
0 commit comments