cli: More informative `rad patch show`
Show entire patch commit history using `rad log --patch`.
This commit is contained in:
parent
2295bb4ea4
commit
a0588460f3
|
|
@ -72,6 +72,14 @@ No description provided.
|
|||
|
||||
╰───────────────────────────────────
|
||||
|
||||
9dad201 Define power requirements
|
||||
commit 9dad201e2cb3306dd708b4a9ebe811b293e27196
|
||||
Author: radicle <radicle@localhost>
|
||||
Date: Thu Dec 15 17:28:04 2022 +0000
|
||||
|
||||
Define power requirements
|
||||
|
||||
diff --git a/README.md b/README.md
|
||||
new file mode 100644
|
||||
index 0000000..e69de29
|
||||
|
||||
```
|
||||
|
|
|
|||
|
|
@ -7,6 +7,20 @@ use radicle::git;
|
|||
use radicle::prelude::*;
|
||||
use radicle::storage::git::Repository;
|
||||
|
||||
fn show_patch_diff(
|
||||
patch: &patch::Patch,
|
||||
storage: &Repository,
|
||||
workdir: &git::raw::Repository,
|
||||
) -> anyhow::Result<()> {
|
||||
let target_head = patch_merge_target_oid(patch.target(), storage)?;
|
||||
let base_oid = workdir.merge_base(target_head, **patch.head())?;
|
||||
let diff = format!("{}..{}", base_oid, patch.head());
|
||||
|
||||
let output = git::run::<_, _, &str, &str>(workdir.path(), ["log", "--patch", &diff], [])?;
|
||||
term::blob(output);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn run(
|
||||
storage: &Repository,
|
||||
profile: &Profile,
|
||||
|
|
@ -25,10 +39,7 @@ pub fn run(
|
|||
term::patch::print_title_desc(patch.title(), patch.description().unwrap_or(""));
|
||||
term::blank();
|
||||
|
||||
let target_head = patch_merge_target_oid(patch.target(), storage)?;
|
||||
let base_oid = workdir.merge_base(target_head, **patch.head())?;
|
||||
let commits = patch_commits(workdir, &base_oid, patch.head())?;
|
||||
term::patch::list_commits(&commits)?;
|
||||
show_patch_diff(&patch, storage, workdir)?;
|
||||
term::blank();
|
||||
|
||||
Ok(())
|
||||
|
|
|
|||
Loading…
Reference in New Issue