Skip to content

Commit 2fd03b9

Browse files
committed
Expose commit type (try/master) from the server
1 parent 62f88a8 commit 2fd03b9

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

site/frontend/src/pages/compare/types.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,13 @@ export interface CompareSelector {
1616
stat: string;
1717
}
1818

19+
export type CommitType = "try" | "master";
20+
1921
export interface ArtifactDescription {
2022
commit: string;
2123
date: string | null;
2224
pr: number | null;
25+
type: CommitType;
2326
bootstrap: Dict<number>;
2427
bootstrap_total: number;
2528
component_sizes: Dict<number>;

site/src/api.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,11 +183,19 @@ pub mod comparison {
183183
pub compile_benchmark_metadata: Vec<CompileBenchmarkMetadata>,
184184
}
185185

186+
#[derive(Debug, Clone, Serialize)]
187+
#[serde(rename_all = "lowercase")]
188+
pub enum CommitType {
189+
Master,
190+
Try,
191+
}
192+
186193
#[derive(Debug, Clone, Serialize)]
187194
pub struct ArtifactDescription {
188195
pub commit: String,
189196
pub date: Option<Date>,
190197
pub pr: Option<u32>,
198+
pub r#type: CommitType,
191199
pub bootstrap: HashMap<String, u64>,
192200
pub bootstrap_total: u64,
193201
pub component_sizes: HashMap<String, u64>,

site/src/comparison.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1038,6 +1038,13 @@ impl From<ArtifactDescription> for api::comparison::ArtifactDescription {
10381038
ArtifactId::Commit(c) => c.sha,
10391039
ArtifactId::Tag(t) => t,
10401040
},
1041+
r#type: match &data.artifact {
1042+
ArtifactId::Commit(c) => match c.r#type {
1043+
CommitType::Master => api::comparison::CommitType::Master,
1044+
CommitType::Try => api::comparison::CommitType::Try,
1045+
},
1046+
ArtifactId::Tag(_) => api::comparison::CommitType::Master,
1047+
},
10411048
date: if let ArtifactId::Commit(c) = &data.artifact {
10421049
Some(c.date)
10431050
} else {

0 commit comments

Comments
 (0)