@@ -25,26 +25,22 @@ pub async fn handle_triage(
25
25
) -> Result < api:: triage:: Response , BoxedError > {
26
26
let start = body. start ;
27
27
let end = body. end ;
28
- // Compare against self to get next
29
28
let master_commits = collector:: master_commits ( ) . await ?;
30
- let comparison = compare_given_commits (
31
- start. clone ( ) ,
32
- start. clone ( ) ,
33
- "instructions:u" . to_owned ( ) ,
34
- ctxt,
35
- & master_commits,
36
- )
37
- . await ?
38
- . unwrap ( ) ;
39
- let mut after = Bound :: Commit ( comparison. next ( & master_commits) . unwrap ( ) ) ; // TODO: handle no next commit
29
+
30
+ let start_artifact = ctxt
31
+ . artifact_id_for_bound ( start. clone ( ) , true )
32
+ . ok_or ( format ! ( "could not find start commit for bound {:?}" , start) ) ?;
33
+ let mut next = next_commit ( & start_artifact, & master_commits)
34
+ . map ( |c| Bound :: Commit ( c. sha . clone ( ) ) )
35
+ . unwrap ( ) ; // TODO: handle no next commit
40
36
41
37
let mut report = HashMap :: new ( ) ;
42
38
let mut before = start. clone ( ) ;
43
39
44
40
loop {
45
41
let comparison = match compare_given_commits (
46
42
before,
47
- after . clone ( ) ,
43
+ next . clone ( ) ,
48
44
"instructions:u" . to_owned ( ) ,
49
45
ctxt,
50
46
& master_commits,
@@ -55,7 +51,7 @@ pub async fn handle_triage(
55
51
None => {
56
52
log:: info!(
57
53
"No data found for end bound {:?}. Ending comparison..." ,
58
- after
54
+ next
59
55
) ;
60
56
break ;
61
57
}
@@ -72,14 +68,14 @@ pub async fn handle_triage(
72
68
// Check that there is a next commit and that the
73
69
// after commit is not equal to `end`
74
70
match comparison. next ( & master_commits) . map ( Bound :: Commit ) {
75
- Some ( next ) if Some ( & after ) != end. as_ref ( ) => {
76
- before = after ;
77
- after = next ;
71
+ Some ( n ) if Some ( & next ) != end. as_ref ( ) => {
72
+ before = next ;
73
+ next = n ;
78
74
}
79
75
_ => break ,
80
76
}
81
77
}
82
- let end = end. unwrap_or ( after ) ;
78
+ let end = end. unwrap_or ( next ) ;
83
79
84
80
let report = generate_report ( & start, & end, report) . await ;
85
81
Ok ( api:: triage:: Response ( report) )
0 commit comments