Skip to content

Commit 6703b75

Browse files
committed
Inline the master_commits call
1 parent 922579d commit 6703b75

File tree

10 files changed

+331
-503
lines changed

10 files changed

+331
-503
lines changed

Cargo.lock

Lines changed: 292 additions & 488 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

collector/Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,13 @@ serde = { version = "1", features = ["derive"] }
1414
serde_json = "1"
1515
tempfile = "3"
1616
libc = "0.2"
17-
chrono = "0.4"
17+
chrono = { version = "0.4", features = ["serde"] }
1818
lazy_static = "1"
1919
semver = "1.0"
2020
reqwest = { version = "0.11", features = ["json"] }
2121
xz2 = "0.1.3"
2222
tar = "0.4"
2323
tokio = { version = "1.6", features = ["rt"] }
24-
rustc-artifacts = { path = "../../rustc-artifacts"}
2524
database = { path = "../database" }
2625
intern = { path = "../intern" }
2726
futures = "0.3.5"

collector/src/lib.rs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,3 +224,29 @@ pub fn command_output(cmd: &mut Command) -> anyhow::Result<process::Output> {
224224

225225
Ok(output)
226226
}
227+
228+
#[derive(Debug, Clone, Deserialize)]
229+
pub struct MasterCommit {
230+
pub sha: String,
231+
pub parent_sha: String,
232+
/// This is the pull request which this commit merged in.
233+
#[serde(default)]
234+
pub pr: Option<u32>,
235+
pub time: chrono::DateTime<chrono::Utc>,
236+
}
237+
238+
/// This provides the master-branch Rust commits which should have accompanying
239+
/// bors artifacts available.
240+
///
241+
/// The first commit returned (at index 0) is the most recent, the last is the
242+
/// oldest.
243+
///
244+
/// Specifically, this is the last 168 days of bors commits.
245+
///
246+
/// Note that this does not contain try commits today, so it should not be used
247+
/// to validate hashes or expand them generally speaking. This may also change
248+
/// in the future.
249+
pub async fn master_commits() -> Result<Vec<MasterCommit>, Box<dyn std::error::Error + Sync + Send>> {
250+
let response = reqwest::get("https://triage.rust-lang.org/bors-commit-list").await?;
251+
Ok(response.json().await?)
252+
}

collector/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -811,7 +811,7 @@ fn main_result() -> anyhow::Result<i32> {
811811
pub fn get_commit_or_fake_it(sha: &str) -> anyhow::Result<Commit> {
812812
let rt = tokio::runtime::Runtime::new().unwrap();
813813
Ok(rt
814-
.block_on(rustc_artifacts::master_commits())
814+
.block_on(collector::master_commits())
815815
.map_err(|e| anyhow::anyhow!("{:?}", e))
816816
.context("getting master commit list")?
817817
.into_iter()

site/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ toml = "0.5"
3030
rust_team_data = { git = "https://github.com/rust-lang/team" }
3131
parking_lot = "0.11"
3232
snap = "1"
33-
rustc-artifacts = { path = "../../rustc-artifacts"}
3433
itertools = "0.10"
3534
hashbrown = { version = "0.11", features = ["serde"] }
3635
arc-swap = "1.3"

site/src/comparison.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ pub async fn handle_triage(
2424
let start = body.start;
2525
let end = body.end;
2626
// Compare against self to get next
27-
let master_commits = rustc_artifacts::master_commits().await?;
27+
let master_commits = collector::master_commits().await?;
2828
let comparison = compare(
2929
start.clone(),
3030
start.clone(),
@@ -76,7 +76,7 @@ pub async fn handle_compare(
7676
body: api::days::Request,
7777
data: &InputData,
7878
) -> Result<api::days::Response, BoxedError> {
79-
let commits = rustc_artifacts::master_commits().await?;
79+
let commits = collector::master_commits().await?;
8080
let comparison =
8181
crate::comparison::compare(body.start, body.end, body.stat, data, &commits).await?;
8282

@@ -201,7 +201,7 @@ pub async fn compare(
201201
end: Bound,
202202
stat: String,
203203
data: &InputData,
204-
master_commits: &[rustc_artifacts::Commit],
204+
master_commits: &[collector::MasterCommit],
205205
) -> Result<Comparison, BoxedError> {
206206
let a = data
207207
.data_for(true, start.clone())
@@ -245,7 +245,7 @@ impl DateData {
245245
conn: &dyn database::Connection,
246246
commit: ArtifactId,
247247
series: &mut [selector::SeriesResponse<T>],
248-
master_commits: &[rustc_artifacts::Commit],
248+
master_commits: &[collector::MasterCommit],
249249
) -> Self
250250
where
251251
T: Iterator<Item = (db::ArtifactId, Option<f64>)>,
@@ -324,7 +324,7 @@ pub struct Comparison {
324324

325325
impl Comparison {
326326
/// Gets the previous commit before `a`
327-
pub fn prev(&self, master_commits: &[rustc_artifacts::Commit]) -> Option<String> {
327+
pub fn prev(&self, master_commits: &[collector::MasterCommit]) -> Option<String> {
328328
match &self.a_id {
329329
ArtifactId::Commit(a) => master_commits
330330
.iter()
@@ -338,7 +338,7 @@ impl Comparison {
338338
pub async fn is_contiguous(
339339
&self,
340340
conn: &dyn database::Connection,
341-
master_commits: &[rustc_artifacts::Commit],
341+
master_commits: &[collector::MasterCommit],
342342
) -> bool {
343343
match (&self.a_id, &self.b_id) {
344344
(ArtifactId::Commit(a), ArtifactId::Commit(b)) => {
@@ -353,7 +353,7 @@ impl Comparison {
353353
}
354354

355355
/// Gets the sha of the next commit after `b`
356-
pub fn next(&self, master_commits: &[rustc_artifacts::Commit]) -> Option<String> {
356+
pub fn next(&self, master_commits: &[collector::MasterCommit]) -> Option<String> {
357357
match &self.b_id {
358358
ArtifactId::Commit(b) => master_commits
359359
.iter()

site/src/load.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ impl InputData {
147147
pub async fn missing_commits(&self) -> Vec<(Commit, MissingReason)> {
148148
let conn = self.conn().await;
149149
let (master_commits, queued_commits, in_progress_artifacts) = futures::join!(
150-
rustc_artifacts::master_commits(),
150+
collector::master_commits(),
151151
conn.queued_commits(),
152152
conn.in_progress_artifacts()
153153
);

site/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ async fn main() {
6767
futures::pin_mut!(fut);
6868
loop {
6969
futures::select! {
70-
s = server => {
70+
_s = server => {
7171
eprintln!("Server completed unexpectedly.");
7272
return;
7373
}

site/src/self_profile/crox.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ pub fn generate(pieces: super::Pieces, opt: Opt) -> anyhow::Result<Vec<u8>> {
130130

131131
let mut seq = serializer.serialize_seq(None)?;
132132

133-
let data = ProfilingData::from_buffers(pieces.string_data, pieces.string_index, pieces.events)
133+
let data = ProfilingData::from_buffers(pieces.string_data, pieces.string_index, pieces.events, None)
134134
.map_err(|e| anyhow::format_err!("{:?}", e))?;
135135

136136
let thread_to_collapsed_thread =

site/src/self_profile/flamegraph.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ pub struct Opt {}
77

88
pub fn generate(title: &str, pieces: super::Pieces, _: Opt) -> anyhow::Result<Vec<u8>> {
99
let profiling_data =
10-
ProfilingData::from_buffers(pieces.string_data, pieces.string_index, pieces.events)
10+
ProfilingData::from_buffers(pieces.string_data, pieces.string_index, pieces.events, None)
1111
.map_err(|e| anyhow::format_err!("{:?}", e))?;
1212

1313
let recorded_stacks = collapse_stacks(&profiling_data)

0 commit comments

Comments
 (0)