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