Skip to content

Commit d00760d

Browse files
authored
Merge pull request #1407 from rust-lang/fix-bootstrap-master-commits
Only display master commits in bootstrap chart
2 parents a41961c + 354f20e commit d00760d

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

database/src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,9 @@ impl Commit {
178178
pub fn is_try(&self) -> bool {
179179
matches!(self.r#type, CommitType::Try)
180180
}
181+
pub fn is_master(&self) -> bool {
182+
matches!(self.r#type, CommitType::Master)
183+
}
181184
}
182185

183186
impl hash::Hash for Commit {

site/src/request_handlers/bootstrap.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@ pub async fn handle_bootstrap(
1212
) -> ServerResult<bootstrap::Response> {
1313
log::info!("handle_bootstrap({:?})", body);
1414
let range = ctxt.data_range(body.start.clone()..=body.end.clone());
15-
let commits: Vec<ArtifactId> = range.iter().map(|c| c.clone().into()).collect();
15+
let commits: Vec<ArtifactId> = range
16+
.into_iter()
17+
.filter(|c| c.is_master())
18+
.map(|c| c.into())
19+
.collect();
1620

1721
let conn = ctxt.conn().await;
1822
let ids = commits

site/src/request_handlers/graph.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
use collector::Bound;
2-
use database::CommitType;
32
use std::collections::HashMap;
43
use std::sync::Arc;
54

@@ -149,9 +148,7 @@ fn artifact_ids_for_range(ctxt: &SiteCtxt, start: Bound, end: Bound) -> Vec<Arti
149148
range
150149
.into_iter()
151150
.enumerate()
152-
.filter(|(index, commit)| {
153-
*index == 0 || *index == count - 1 || matches!(commit.r#type, CommitType::Master)
154-
})
151+
.filter(|(index, commit)| *index == 0 || *index == count - 1 || commit.is_master())
155152
.map(|c| c.1.into())
156153
.collect()
157154
}

0 commit comments

Comments
 (0)