File tree Expand file tree Collapse file tree 2 files changed +13
-12
lines changed Expand file tree Collapse file tree 2 files changed +13
-12
lines changed Original file line number Diff line number Diff line change @@ -180,7 +180,7 @@ fn postprocess_metrics(
180
180
}
181
181
182
182
fn post_merge_report ( db : JobDatabase , current : String , parent : String ) -> anyhow:: Result < ( ) > {
183
- let metrics = download_auto_job_metrics ( & db, & parent, & current) ?;
183
+ let metrics = download_auto_job_metrics ( & db, Some ( & parent) , & current) ?;
184
184
185
185
println ! ( "\n Comparing {parent} (parent) -> {current} (this PR)\n " ) ;
186
186
Original file line number Diff line number Diff line change @@ -46,24 +46,25 @@ pub struct JobMetrics {
46
46
/// `parent` and `current` should be commit SHAs.
47
47
pub fn download_auto_job_metrics (
48
48
job_db : & JobDatabase ,
49
- parent : & str ,
49
+ parent : Option < & str > ,
50
50
current : & str ,
51
51
) -> anyhow:: Result < HashMap < JobName , JobMetrics > > {
52
52
let mut jobs = HashMap :: default ( ) ;
53
53
54
54
for job in & job_db. auto_jobs {
55
55
eprintln ! ( "Downloading metrics of job {}" , job. name) ;
56
- let metrics_parent = match download_job_metrics ( & job. name , parent) {
57
- Ok ( metrics) => Some ( metrics) ,
58
- Err ( error) => {
59
- eprintln ! (
60
- r#"Did not find metrics for job `{}` at `{parent}`: {error:?}.
56
+ let metrics_parent =
57
+ parent. and_then ( |parent| match download_job_metrics ( & job. name , parent) {
58
+ Ok ( metrics) => Some ( metrics) ,
59
+ Err ( error) => {
60
+ eprintln ! (
61
+ r#"Did not find metrics for job `{}` at `{parent}`: {error:?}.
61
62
Maybe it was newly added?"# ,
62
- job. name
63
- ) ;
64
- None
65
- }
66
- } ;
63
+ job. name
64
+ ) ;
65
+ None
66
+ }
67
+ } ) ;
67
68
let metrics_current = download_job_metrics ( & job. name , current) ?;
68
69
jobs. insert (
69
70
job. name . clone ( ) ,
You can’t perform that action at this time.
0 commit comments