diff --git a/radicle-cli/examples/rad-patch-draft.md b/radicle-cli/examples/rad-patch-draft.md index 428dd7f5..fd869bc4 100644 --- a/radicle-cli/examples/rad-patch-draft.md +++ b/radicle-cli/examples/rad-patch-draft.md @@ -25,6 +25,8 @@ $ rad patch show 6d7793b859860db775fd8ff1d18ffb6de2b9ca0e │ Commits ahead 1, behind 0 │ │ Status draft │ ├─────────────────────────────────────────────────────────────────────────────────────────┤ +│ 2a46583 Nothing to see here.. │ +├─────────────────────────────────────────────────────────────────────────────────────────┤ │ ● opened by did:key:z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi (you) [ ... ] │ ╰─────────────────────────────────────────────────────────────────────────────────────────╯ ``` @@ -46,6 +48,8 @@ $ rad patch show 6d7793b859860db775fd8ff1d18ffb6de2b9ca0e │ Commits ahead 1, behind 0 │ │ Status open │ ├─────────────────────────────────────────────────────────────────────────────────────────┤ +│ 2a46583 Nothing to see here.. │ +├─────────────────────────────────────────────────────────────────────────────────────────┤ │ ● opened by did:key:z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi (you) [ ... ] │ ╰─────────────────────────────────────────────────────────────────────────────────────────╯ ``` @@ -65,5 +69,7 @@ $ rad patch show 6d7793b859860db775fd8ff1d18ffb6de2b9ca0e │ Commits ahead 1, behind 0 │ │ Status draft │ ├─────────────────────────────────────────────────────────────────────────────────────────┤ +│ 2a46583 Nothing to see here.. │ +├─────────────────────────────────────────────────────────────────────────────────────────┤ │ ● opened by did:key:z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi (you) [ ... ] │ ╰─────────────────────────────────────────────────────────────────────────────────────────╯ diff --git a/radicle-cli/examples/rad-patch-via-push.md b/radicle-cli/examples/rad-patch-via-push.md index b4c2407f..b021f693 100644 --- a/radicle-cli/examples/rad-patch-via-push.md +++ b/radicle-cli/examples/rad-patch-via-push.md @@ -25,6 +25,8 @@ $ rad patch show 8f0e8ec │ Commits ahead 1, behind 0 │ │ Status open │ ├─────────────────────────────────────────────────────────────────────────────────────────┤ +│ 42d894a Add things │ +├─────────────────────────────────────────────────────────────────────────────────────────┤ │ ● opened by did:key:z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi (you) [ .. ] │ ╰─────────────────────────────────────────────────────────────────────────────────────────╯ ``` @@ -140,6 +142,10 @@ $ rad patch show 8678aaf │ Commits ahead 3, behind 0 │ │ Status open │ ├─────────────────────────────────────────────────────────────────────────────────────────┤ +│ 662843e Improve code │ +│ b94a835 Add more things │ +│ 42d894a Add things │ +├─────────────────────────────────────────────────────────────────────────────────────────┤ │ ● opened by did:key:z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi (you) [ ... ] │ │ ↑ updated to 4b6618a6ccb0b406659364a70a00bb60e4cd7cf0 (662843e) [ ... ] │ ╰─────────────────────────────────────────────────────────────────────────────────────────╯ @@ -213,6 +219,10 @@ $ rad patch show 8678aaf │ Commits ahead 3, behind 0 │ │ Status open │ ├─────────────────────────────────────────────────────────────────────────────────────────┤ +│ 3507cd5 Amended commit │ +│ b94a835 Add more things │ +│ 42d894a Add things │ +├─────────────────────────────────────────────────────────────────────────────────────────┤ │ ● opened by did:key:z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi (you) 4 months ago │ │ ↑ updated to 4b6618a6ccb0b406659364a70a00bb60e4cd7cf0 (662843e) 4 months ago │ │ ↑ updated to 983f2d21c9fbe91c21ddfbcd3e3d6cd13db0a944 (3507cd5) 4 months ago │ diff --git a/radicle-cli/examples/rad-patch.md b/radicle-cli/examples/rad-patch.md index f35346fe..710a9256 100644 --- a/radicle-cli/examples/rad-patch.md +++ b/radicle-cli/examples/rad-patch.md @@ -60,6 +60,8 @@ $ rad patch show de3096d5cc422136016ac210b870bfa9d0f11481 -p │ │ │ See details. │ ├─────────────────────────────────────────────────────────────────────────────────────────┤ +│ 3e674d1 Define power requirements │ +├─────────────────────────────────────────────────────────────────────────────────────────┤ │ ● opened by did:key:z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi (you) [ ... ]│ ╰─────────────────────────────────────────────────────────────────────────────────────────╯ @@ -135,6 +137,9 @@ $ rad patch show de3096d │ │ │ See details. │ ├─────────────────────────────────────────────────────────────────────────────────────────┤ +│ 27857ec Add README, just for the fun │ +│ 3e674d1 Define power requirements │ +├─────────────────────────────────────────────────────────────────────────────────────────┤ │ ● opened by did:key:z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi (you) [ ... ]│ │ ↑ updated to d00f978a43a255c7f2f9f23d39b555d103900c6d (27857ec) [ ... ]│ │ ✓ accepted by z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi (you) [ ... ]│ @@ -157,6 +162,9 @@ $ rad patch show de3096d │ │ │ Add requirements file │ ├─────────────────────────────────────────────────────────────────────────────────────────┤ +│ 27857ec Add README, just for the fun │ +│ 3e674d1 Define power requirements │ +├─────────────────────────────────────────────────────────────────────────────────────────┤ │ ● opened by did:key:z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi (you) [ ... ]│ │ ↑ updated to d00f978a43a255c7f2f9f23d39b555d103900c6d (27857ec) [ ... ]│ │ ✓ accepted by z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi (you) [ ... ]│ diff --git a/radicle-cli/examples/workflow/4-patching-contributor.md b/radicle-cli/examples/workflow/4-patching-contributor.md index ef3c2f0e..ad78fb79 100644 --- a/radicle-cli/examples/workflow/4-patching-contributor.md +++ b/radicle-cli/examples/workflow/4-patching-contributor.md @@ -58,6 +58,8 @@ $ rad patch show 5f0a547f7a91bf002bb0542035a647fd5af134a5 │ │ │ See details. │ ├─────────────────────────────────────────────────────────────────────────────────────────┤ +│ 3e674d1 Define power requirements │ +├─────────────────────────────────────────────────────────────────────────────────────────┤ │ ● opened by did:key:z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk (you) [ ... ]│ ╰─────────────────────────────────────────────────────────────────────────────────────────╯ ``` diff --git a/radicle-cli/examples/workflow/5-patching-maintainer.md b/radicle-cli/examples/workflow/5-patching-maintainer.md index fb3466f0..9b6457b4 100644 --- a/radicle-cli/examples/workflow/5-patching-maintainer.md +++ b/radicle-cli/examples/workflow/5-patching-maintainer.md @@ -43,6 +43,9 @@ $ rad patch show 5f0a547 │ │ │ See details. │ ├───────────────────────────────────────────────────────────────────────────────────┤ +│ 27857ec Add README, just for the fun │ +│ 3e674d1 Define power requirements │ +├───────────────────────────────────────────────────────────────────────────────────┤ │ ● opened by did:key:z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk [ ... ] │ │ ↑ updated to b7e2356fb7e3981980b42603eea969851d17a40d (27857ec) [ ... ] │ ╰───────────────────────────────────────────────────────────────────────────────────╯ @@ -101,6 +104,10 @@ $ rad patch show 5f0a547 │ │ │ See details. │ ├─────────────────────────────────────────────────────────────────────────────────────────┤ +│ f6484e0 fixup! Define power requirements │ +│ 27857ec Add README, just for the fun │ +│ 3e674d1 Define power requirements │ +├─────────────────────────────────────────────────────────────────────────────────────────┤ │ ● opened by did:key:z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk [ ... ] │ │ ↑ updated to b7e2356fb7e3981980b42603eea969851d17a40d (27857ec) [ ... ] │ │ ↑ updated to 4486280d0dec743d6a1a0c05754f8e40426c681d (f6484e0) [ ... ] │ diff --git a/radicle-cli/src/commands/ls.rs b/radicle-cli/src/commands/ls.rs index 73e5e916..b06861c6 100644 --- a/radicle-cli/src/commands/ls.rs +++ b/radicle-cli/src/commands/ls.rs @@ -18,7 +18,7 @@ Usage Options - --versbose, -v Verbose output + --verbose, -v Verbose output --help Print help "#, }; diff --git a/radicle-cli/src/commands/patch/show.rs b/radicle-cli/src/commands/patch/show.rs index 65049e20..494d0037 100644 --- a/radicle-cli/src/commands/patch/show.rs +++ b/radicle-cli/src/commands/patch/show.rs @@ -29,6 +29,31 @@ fn show_patch_diff(patch: &patch::Patch, storage: &Repository) -> anyhow::Result Ok(()) } +fn patch_commits(patch: &patch::Patch, stored: &Repository) -> anyhow::Result> { + let target_head = patch_merge_target_oid(patch.target(), stored)?; + let base_oid = stored.raw().merge_base(target_head, **patch.head())?; + let range = format!("{}..{}", base_oid, patch.head()); + + let mut revwalk = stored.revwalk(*patch.head())?; + let mut lines = Vec::new(); + + revwalk.push_range(&range)?; + + for commit in revwalk { + let commit = commit?; + let commit = stored.raw().find_commit(commit)?; + + lines.push(term::Line::spaced([ + term::label(term::format::secondary(term::format::oid(commit.id()))), + term::label(term::format::default( + commit.summary().unwrap_or_default().to_owned(), + )), + ])); + } + + Ok(lines) +} + pub fn run( profile: &Profile, stored: &Repository, @@ -90,6 +115,7 @@ pub fn run( .into(), ]); + let commits = patch_commits(&patch, stored)?; let description = patch.description().trim(); let mut widget = VStack::default() .border(Some(term::colors::FAINT)) @@ -102,6 +128,8 @@ pub fn run( } else { vec![] }) + .divider() + .children(commits.into_iter().map(|l| l.boxed())) .divider(); for line in list::timeline(profile.id(), patch_id, &patch, stored)? { diff --git a/radicle-term/src/element.rs b/radicle-term/src/element.rs index a8bf812c..6fee187e 100644 --- a/radicle-term/src/element.rs +++ b/radicle-term/src/element.rs @@ -146,6 +146,10 @@ impl Line { self.items.push(Label::space()); self } + + pub fn boxed(self) -> Box { + Box::new(self) + } } impl IntoIterator for Line {