hive-forge: show/pr show now list current dependencies
This commit is contained in:
parent
7bad72d354
commit
29a11476a4
3 changed files with 34 additions and 3 deletions
|
|
@ -46,7 +46,7 @@ pub mod view;
|
|||
use std::fmt::Write as _;
|
||||
|
||||
use anyhow::Result;
|
||||
use serde_json::Value;
|
||||
use serde_json::{Value, json};
|
||||
use time::OffsetDateTime;
|
||||
use time::format_description::well_known::Rfc3339;
|
||||
|
||||
|
|
@ -204,6 +204,33 @@ pub(crate) fn latest_reviews(client: &Client, repo: &str, pr: u64) -> Result<Vec
|
|||
Ok(latest)
|
||||
}
|
||||
|
||||
/// The current dependency list for an issue or PR — each entry names
|
||||
/// another issue/PR this one is blocked on. Forgejo's dependency endpoint
|
||||
/// works on the shared issue/PR index (PRs are issues internally under
|
||||
/// the hood), so `issue show` and `pr show` both call this instead of
|
||||
/// duplicating the fetch-and-shape step. A reviewer asked whether
|
||||
/// `show`/`view` surface dependencies — they didn't (only `timeline`
|
||||
/// rendered them, as history); this is the current-state complement.
|
||||
///
|
||||
/// # Errors
|
||||
///
|
||||
/// Propagates the forge API errors from listing dependencies.
|
||||
pub(crate) fn dependency_summaries(
|
||||
client: &Client,
|
||||
owner: &str,
|
||||
name: &str,
|
||||
number: u64,
|
||||
) -> Result<Vec<Value>> {
|
||||
let deps = client
|
||||
.api()
|
||||
.issue_list_issue_dependencies(owner, name, index(number)?)
|
||||
.send()?;
|
||||
Ok(deps
|
||||
.into_iter()
|
||||
.map(|d| json!({ "number": d.number, "title": d.title }))
|
||||
.collect())
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::pct_encode;
|
||||
|
|
|
|||
Loading…
Reference in a new issue