Переглянути джерело

Merge pull request #1345 from sladyn98/multi-query-repo

Add multi-repo query support
Niko Matsakis 3 роки тому
батько
коміт
2083b33503
4 змінених файлів з 245 додано та 124 видалено
  1. 139 0
      lang-agenda.md
  2. 77 67
      src/actions.rs
  3. 28 52
      src/agenda.rs
  4. 1 5
      templates/lang_agenda.tt

+ 139 - 0
lang-agenda.md

@@ -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
+
+

+ 77 - 67
src/actions.rs

@@ -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>>,
 }
 
@@ -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);
+                                }
                             }
                         }
-                    }
-                };
+                    };
+                }
             }
         }
 

+ 28 - 52
src/agenda.rs

@@ -81,7 +81,7 @@ pub fn prioritization<'a>() -> Box<dyn Action> {
     });
 
     actions.push(Query {
-        repo: "rust-lang/compiler-team",
+        repos: vec!["rust-lang/compiler-team"],
         queries,
     });
 
@@ -121,7 +121,7 @@ pub fn prioritization<'a>() -> Box<dyn Action> {
     });
 
     actions.push(Query {
-        repo: "rust-lang/rust",
+        repos: vec!["rust-lang/rust"],
         queries,
     });
 
@@ -161,7 +161,7 @@ pub fn prioritization<'a>() -> Box<dyn Action> {
     });
 
     actions.push(Query {
-        repo: "rust-lang/rust-forge",
+        repos: vec!["rust-lang/rust-forge"],
         queries,
     });
 
@@ -482,7 +482,7 @@ pub fn prioritization<'a>() -> Box<dyn Action> {
     });
 
     actions.push(Query {
-        repo: "rust-lang/rust",
+        repos: vec!["rust-lang/rust"],
         queries,
     });
 
@@ -502,7 +502,7 @@ pub fn prioritization<'a>() -> Box<dyn Action> {
     });
 
     actions.push(Query {
-        repo: "rust-lang/rfcs",
+        repos: vec!["rust-lang/rfcs"],
         queries,
     });
 
@@ -538,7 +538,7 @@ pub fn lang<'a>() -> Box<dyn Action> {
     });
 
     actions.push(Query {
-        repo: "rust-lang/lang-team",
+        repos: vec!["rust-lang/lang-team"],
         queries,
     });
 
@@ -567,58 +567,34 @@ pub fn lang<'a>() -> Box<dyn Action> {
     });
 
     actions.push(Query {
-        repo: "rust-lang/rfcs",
+        repos: vec!["rust-lang/rfcs"],
         queries,
     });
 
-    let mut queries = Vec::new();
-
-    // https://github.com/rust-lang/rust/issues?q=is%3Aissue+is%3Aopen+label%3AP-high+label%3AT-lang
-    queries.push(QueryMap {
-        name: "p_high_issues",
-        query: github::Query {
-            kind: github::QueryKind::List,
-            filters: vec![("state", "open")],
-            include_labels: vec!["T-lang", "P-high"],
-            exclude_labels: vec![],
-        },
-    });
-
-    // https://github.com/rust-lang/rust/issues?utf8=%E2%9C%93&q=is%3Aopen+is%3Aissue+label%3AI-nominated+label%3AT-lang+
-    queries.push(QueryMap {
-        name: "nominated_prs_issues",
-        query: github::Query {
-            kind: github::QueryKind::List,
-            filters: vec![("state", "open")],
-            include_labels: vec!["T-lang", "I-nominated"],
-            exclude_labels: vec![],
-        },
-    });
-
     actions.push(Query {
-        repo: "rust-lang/rust",
-        queries,
+        repos: vec!["rust-lang/rust", "rust-lang/reference"],
+        queries: vec![
+            QueryMap {
+                name: "p_high_issues",
+                query: github::Query {
+                    kind: github::QueryKind::List,
+                    filters: vec![("state", "open")],
+                    include_labels: vec!["T-lang", "P-high"],
+                    exclude_labels: vec![],
+                },
+            },
+            QueryMap {
+                name: "nominated_prs_issues",
+                query: github::Query {
+                    kind: github::QueryKind::List,
+                    filters: vec![("state", "open")],
+                    include_labels: vec!["T-lang", "I-nominated"],
+                    exclude_labels: vec![],
+                },
+            },
+        ],
     });
 
-    let mut queries = Vec::new();
-
-    // https://github.com/rust-lang/reference/labels/I-nominated
-    queries.push(QueryMap {
-        name: "nominated_reference_issues",
-        query: github::Query {
-            kind: github::QueryKind::List,
-            filters: vec![("state", "open")],
-            include_labels: vec!["I-nominated"],
-            exclude_labels: vec![],
-        },
-    });
-
-    actions.push(Query {
-        repo: "rust-lang/reference",
-        queries,
-    });
-
-
     Box::new(Step {
         name: "lang_agenda",
         actions,

+ 1 - 5
templates/lang_agenda.tt

@@ -39,10 +39,6 @@ tags: triage-meeting
 
 {{-issues_heading::render(issues=p_high_issues, empty="No P-high issues this time.")}}
 
-## Nominated PRs and issues on rust-lang/reference
-
-{{-issues_heading::render(issues=nominated_reference_issues, empty="No nominated items this time.")}}
-
-## Nominated PRs and issues on rust-lang/rust
+## Nominated PRs and issues
 
 {{-issues_heading::render(issues=nominated_prs_issues, empty="No nominated items this time.")}}