cli: Show commit listing in `rad patch show`
This commit is contained in:
parent
4caafa9ce2
commit
103ee4e23d
|
|
@ -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) [ ... ] │
|
||||
╰─────────────────────────────────────────────────────────────────────────────────────────╯
|
||||
|
|
|
|||
|
|
@ -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 │
|
||||
|
|
|
|||
|
|
@ -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) [ ... ]│
|
||||
|
|
|
|||
|
|
@ -58,6 +58,8 @@ $ rad patch show 5f0a547f7a91bf002bb0542035a647fd5af134a5
|
|||
│ │
|
||||
│ See details. │
|
||||
├─────────────────────────────────────────────────────────────────────────────────────────┤
|
||||
│ 3e674d1 Define power requirements │
|
||||
├─────────────────────────────────────────────────────────────────────────────────────────┤
|
||||
│ ● opened by did:key:z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk (you) [ ... ]│
|
||||
╰─────────────────────────────────────────────────────────────────────────────────────────╯
|
||||
```
|
||||
|
|
|
|||
|
|
@ -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) [ ... ] │
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ Usage
|
|||
|
||||
Options
|
||||
|
||||
--versbose, -v Verbose output
|
||||
--verbose, -v Verbose output
|
||||
--help Print help
|
||||
"#,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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<Vec<term::Line>> {
|
||||
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)? {
|
||||
|
|
|
|||
|
|
@ -146,6 +146,10 @@ impl Line {
|
|||
self.items.push(Label::space());
|
||||
self
|
||||
}
|
||||
|
||||
pub fn boxed(self) -> Box<dyn Element> {
|
||||
Box::new(self)
|
||||
}
|
||||
}
|
||||
|
||||
impl IntoIterator for Line {
|
||||
|
|
|
|||
Loading…
Reference in New Issue