Skip to content

Commit

Permalink
Merge pull request #1345 from sladyn98/multi-query-repo
Browse files Browse the repository at this point in the history
Add multi-repo query support
  • Loading branch information
nikomatsakis authored May 24, 2021
2 parents 6409629 + 0fc0b4d commit 2083b33
Show file tree
Hide file tree
Showing 4 changed files with 245 additions and 124 deletions.
139 changes: 139 additions & 0 deletions lang-agenda.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
---
title: Triage meeting DATE
tags: triage-meeting
---

# T-lang meeting agenda

* Meeting date: DATE

## Attendance

* Team members:
* Others:

## Meeting roles

* Action item scribe:
* Note-taker:

## Scheduled meetings
- "Rust language "guiding principles"" [lang-team#91](https://github.com/rust-lang/lang-team/issues/91)
- "Generators planning" [lang-team#92](https://github.com/rust-lang/lang-team/issues/92)
- "May updates" [lang-team#93](https://github.com/rust-lang/lang-team/issues/93)

## Action item review

* [Action items list](https://hackmd.io/gstfhtXYTHa3Jv-P_2RK7A)

## Pending proposals
### "MCP: Allowing the compiler to eagerly drop values" lang-team#86

**Link:** https://github.com/rust-lang/lang-team/issues/86



## Nominated RFCs
### "RFC: Overconstraining and omitting `unsafe` in impls of `unsafe` trait methods" rfcs#2316

**Link:** https://github.com/rust-lang/rfcs/pull/2316

### "Calling methods on generic parameters of const fns" rfcs#2632

**Link:** https://github.com/rust-lang/rfcs/pull/2632



## P-high issues on rust-lang/rust
### "`fn() -> Out` is a valid type for unsized types `Out`, and it implements `FnOnce<(), Output = Out>`" rust#82633

**Link:** https://github.com/rust-lang/rust/issues/82633

### "Closures are unsound: 'static closures with non-'static return types." rust#84366

**Link:** https://github.com/rust-lang/rust/issues/84366

### "Functions, closures, and HRTB-trait-objects can implement traits such that validity of associated types is never checked." rust#84533

**Link:** https://github.com/rust-lang/rust/issues/84533

### "HRTBs are unsound: HRTB on subtrait provides HTRB on supertrait with weaker implied bounds." rust#84591

**Link:** https://github.com/rust-lang/rust/issues/84591

### "A `Pin` unsoundness involving an `impl DerefMut for Pin<&dyn LocalTrait>`" rust#85099

**Link:** https://github.com/rust-lang/rust/issues/85099



## Nominated PRs and issues
### "Tracking issue for RFC 2523, `#[cfg(version(..))]`" rust#64796

**Link:** https://github.com/rust-lang/rust/issues/64796

### "Stabilize "RangeFrom" patterns" rust#83918

**Link:** https://github.com/rust-lang/rust/pull/83918

### "Uplift the invalid_atomic_ordering lint from clippy to rustc" rust#84039

**Link:** https://github.com/rust-lang/rust/pull/84039

### "Deny float matches" rust#84045

**Link:** https://github.com/rust-lang/rust/pull/84045

### "ICE when reifying function pointers to copy / copy_nonoverlapping using an if" rust#84297

**Link:** https://github.com/rust-lang/rust/issues/84297

### "Add `expr202x` macro pattern" rust#84364

**Link:** https://github.com/rust-lang/rust/pull/84364

### "Allow struct and enum to contain inner attrs" rust#84414

**Link:** https://github.com/rust-lang/rust/pull/84414

### "stabilize member constraints" rust#84701

**Link:** https://github.com/rust-lang/rust/pull/84701

### "implement `Default` for all arrays" rust#84838

**Link:** https://github.com/rust-lang/rust/pull/84838

### "add back support for inner attributes on non-block expressions?" rust#84879

**Link:** https://github.com/rust-lang/rust/issues/84879

### "rustc: Allow safe #[target_feature] on wasm" rust#84988

**Link:** https://github.com/rust-lang/rust/pull/84988

### "Re-add support for parsing (and pretty-printing) inner-attributes in match body" rust#85193

**Link:** https://github.com/rust-lang/rust/pull/85193

### "Stabilize RFC 2345: Allow panicking in constants" rust#85194

**Link:** https://github.com/rust-lang/rust/issues/85194

### "Ignore derived Clone and Debug implementations during dead code analysis" rust#85200

**Link:** https://github.com/rust-lang/rust/pull/85200

### "Check for union field accesses in THIR unsafeck" rust#85263

**Link:** https://github.com/rust-lang/rust/pull/85263

### "RFC: Overconstraining and omitting `unsafe` in impls of `unsafe` trait methods" rfcs#2316

**Link:** https://github.com/rust-lang/rfcs/pull/2316

### "Calling methods on generic parameters of const fns" rfcs#2632

**Link:** https://github.com/rust-lang/rfcs/pull/2632


144 changes: 77 additions & 67 deletions src/actions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pub struct Step<'a> {
}

pub struct Query<'a> {
pub repo: &'a str,
pub repos: Vec<&'a str>,
pub queries: Vec<QueryMap<'a>>,
}

Expand Down Expand Up @@ -57,77 +57,87 @@ impl<'a> Action for Step<'a> {
let mut context = Context::new();
let mut results = HashMap::new();

for Query { repo, queries } in &self.actions {
let repository = Repository {
full_name: repo.to_string(),
};

for QueryMap { name, query } in queries {
match query.kind {
github::QueryKind::List => {
let issues_search_result = repository.get_issues(&gh, &query).await;

match issues_search_result {
Ok(issues) => {
let issues_decorator: Vec<_> = issues
.iter()
.map(|issue| IssueDecorator {
title: issue.title.clone(),
number: issue.number,
html_url: issue.html_url.clone(),
repo_name: repository
.full_name
.split("/")
.last()
.expect("Failed to split repository name")
.to_string(),
labels: issue
.labels
.iter()
.map(|l| l.name.as_ref())
.collect::<Vec<_>>()
.join(", "),
assignees: issue
.assignees
.iter()
.map(|u| u.login.as_ref())
.collect::<Vec<_>>()
.join(", "),
})
.collect();

results
.entry(*name)
.or_insert(Vec::new())
.extend(issues_decorator);
}
Err(err) => {
eprintln!("ERROR: {}", err);
err.chain()
.skip(1)
.for_each(|cause| eprintln!("because: {}", cause));
std::process::exit(1);
}
}
}
for Query { repos, queries} in &self.actions {

github::QueryKind::Count => {
let count = repository.get_issues_count(&gh, &query).await;
for repo in repos {
let repository = Repository {
full_name: repo.to_string(),
};

match count {
Ok(count) => {
context.insert(*name, &count);
for QueryMap { name, query } in queries {
match query.kind {
github::QueryKind::List => {
let issues_search_result = repository.get_issues(&gh, &query).await;

match issues_search_result {
Ok(issues) => {
let issues_decorator: Vec<_> = issues
.iter()
.map(|issue| IssueDecorator {
title: issue.title.clone(),
number: issue.number,
html_url: issue.html_url.clone(),
repo_name: repository
.full_name
.split("/")
.last()
.expect("Failed to split repository name")
.to_string(),
labels: issue
.labels
.iter()
.map(|l| l.name.as_ref())
.collect::<Vec<_>>()
.join(", "),
assignees: issue
.assignees
.iter()
.map(|u| u.login.as_ref())
.collect::<Vec<_>>()
.join(", "),
})
.collect();

results
.entry(*name)
.or_insert(Vec::new())
.extend(issues_decorator);
}
Err(err) => {
eprintln!("ERROR: {}", err);
err.chain()
.skip(1)
.for_each(|cause| eprintln!("because: {}", cause));
std::process::exit(1);
}
}
Err(err) => {
eprintln!("ERROR: {}", err);
err.chain()
.skip(1)
.for_each(|cause| eprintln!("because: {}", cause));
std::process::exit(1);
}

github::QueryKind::Count => {
let count = repository.get_issues_count(&gh, &query).await;

match count {
Ok(count) => {

let result = if let Some(value) = context.get(*name) {
value.as_u64().unwrap() + count as u64
} else {
count as u64
};

context.insert(*name, &result);
}
Err(err) => {
eprintln!("ERROR: {}", err);
err.chain()
.skip(1)
.for_each(|cause| eprintln!("because: {}", cause));
std::process::exit(1);
}
}
}
}
};
};
}
}
}

Expand Down
Loading

0 comments on commit 2083b33

Please sign in to comment.