Skip to content

Commit 2b9051a

Browse files
Merge pull request #1452 from rust-lang/try-commit-filter
Add a filter for try commits in graphs, compare page and triage
2 parents 0c19524 + b15355a commit 2b9051a

File tree

2 files changed

+18
-5
lines changed

2 files changed

+18
-5
lines changed

collector/src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ impl Bound {
3737
pub fn left_match(&self, commit: &Commit) -> bool {
3838
match self {
3939
Bound::Commit(sha) => commit.sha == **sha,
40-
Bound::Date(date) => commit.date.0.naive_utc().date() >= *date,
40+
Bound::Date(date) => commit.is_master() && commit.date.0.naive_utc().date() >= *date,
4141
Bound::None => {
4242
let last_month = chrono::Utc::now().date().naive_utc() - chrono::Duration::days(30);
43-
last_month <= commit.date.0.naive_utc().date()
43+
commit.is_master() && last_month <= commit.date.0.naive_utc().date()
4444
}
4545
}
4646
}
@@ -49,8 +49,8 @@ impl Bound {
4949
pub fn right_match(&self, commit: &Commit) -> bool {
5050
match self {
5151
Bound::Commit(sha) => commit.sha == **sha,
52-
Bound::Date(date) => commit.date.0.date().naive_utc() <= *date,
53-
Bound::None => true,
52+
Bound::Date(date) => commit.is_master() && commit.date.0.date().naive_utc() <= *date,
53+
Bound::None => commit.is_master(),
5454
}
5555
}
5656
}

site/src/request_handlers/graph.rs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,11 @@ async fn create_graphs(
8080
request: graphs::Request,
8181
ctxt: &SiteCtxt,
8282
) -> ServerResult<Arc<graphs::Response>> {
83-
let artifact_ids = Arc::new(artifact_ids_for_range(ctxt, request.start, request.end));
83+
let artifact_ids = Arc::new(master_artifact_ids_for_range(
84+
ctxt,
85+
request.start,
86+
request.end,
87+
));
8488
let mut benchmarks = HashMap::new();
8589

8690
let create_selector = |filter: &Option<String>| -> Selector<String> {
@@ -153,6 +157,15 @@ fn artifact_ids_for_range(ctxt: &SiteCtxt, start: Bound, end: Bound) -> Vec<Arti
153157
.collect()
154158
}
155159

160+
/// Returns master commit artifact IDs for the given range.
161+
fn master_artifact_ids_for_range(ctxt: &SiteCtxt, start: Bound, end: Bound) -> Vec<ArtifactId> {
162+
ctxt.data_range(start..=end)
163+
.into_iter()
164+
.filter(|commit| commit.is_master())
165+
.map(|commit| commit.into())
166+
.collect()
167+
}
168+
156169
/// Creates a summary "benchmark" that averages the results of all other
157170
/// test cases per profile type
158171
fn create_summary(

0 commit comments

Comments
 (0)