@@ -191,9 +191,9 @@ impl FromStr for Bound {
191191}
192192
193193impl Bound {
194- fn as_commit ( self ) -> Result < Self , Error > {
194+ fn sha ( self ) -> Result < String , Error > {
195195 match self {
196- Bound :: Commit ( commit) => Ok ( Bound :: Commit ( commit) ) ,
196+ Bound :: Commit ( commit) => Ok ( commit) ,
197197 Bound :: Date ( date) => {
198198 let date_str = date. format ( YYYY_MM_DD ) ;
199199 let url = format ! ( "{}/{}/channel-rust-nightly-git-commit-hash.txt" , NIGHTLY_SERVER , date_str) ;
@@ -208,10 +208,14 @@ impl Bound {
208208
209209 eprintln ! ( "converted {} to {}" , date_str, commit) ;
210210
211- Ok ( Bound :: Commit ( commit) )
211+ Ok ( commit)
212212 }
213213 }
214214 }
215+
216+ fn as_commit ( self ) -> Result < Self , Error > {
217+ self . sha ( ) . map ( Bound :: Commit )
218+ }
215219}
216220
217221impl Opts {
@@ -1028,19 +1032,17 @@ fn bisect(cfg: &Config, client: &Client) -> Result<(), Error> {
10281032 if let ToolchainSpec :: Nightly { date } = nightly_regression. spec {
10291033 let previous_date = date - chrono:: Duration :: days ( 1 ) ;
10301034
1031- if let Bound :: Commit ( bad_commit) = Bound :: Date ( date) . as_commit ( ) ? {
1032- if let Bound :: Commit ( working_commit) = Bound :: Date ( previous_date) . as_commit ( ) ? {
1033- eprintln ! (
1034- "looking for regression commit between {} and {}" ,
1035- date. format( YYYY_MM_DD ) ,
1036- previous_date. format( YYYY_MM_DD ) ,
1037- ) ;
1038-
1039- let ci_bisection_result = bisect_ci_between ( cfg, client, & working_commit, & bad_commit) ?;
1040- print_results ( cfg, client, & ci_bisection_result) ;
1041- print_final_report ( & nightly_bisection_result, & ci_bisection_result) ;
1042- }
1043- }
1035+ let bad_commit = Bound :: Date ( date) . sha ( ) ?;
1036+ let working_commit = Bound :: Date ( previous_date) . sha ( ) ?;
1037+ eprintln ! (
1038+ "looking for regression commit between {} and {}" ,
1039+ date. format( YYYY_MM_DD ) ,
1040+ previous_date. format( YYYY_MM_DD ) ,
1041+ ) ;
1042+
1043+ let ci_bisection_result = bisect_ci_between ( cfg, client, & working_commit, & bad_commit) ?;
1044+ print_results ( cfg, client, & ci_bisection_result) ;
1045+ print_final_report ( & nightly_bisection_result, & ci_bisection_result) ;
10441046 }
10451047 }
10461048
0 commit comments