radicle-cli/terminal: Add patch target ref to rad patch show
This commit is contained in:
parent
eb2dded0ed
commit
178bda36d8
|
|
@ -47,6 +47,7 @@ $ rad patch show 89f7afb
|
|||
│ Author alice (you) │
|
||||
│ Head 8945f6189adf027892c85ac57f7e9341049c2537 │
|
||||
│ Base [.. ] │
|
||||
│ Target master │
|
||||
│ Branches changes │
|
||||
│ Commits ahead 2, behind 0 │
|
||||
│ Status open │
|
||||
|
|
@ -71,6 +72,7 @@ $ rad patch show 89f7afb
|
|||
│ Author alice (you) │
|
||||
│ Head 8945f6189adf027892c85ac57f7e9341049c2537 │
|
||||
│ Base [.. ] │
|
||||
│ Target master │
|
||||
│ Branches changes │
|
||||
│ Commits ahead 2, behind 0 │
|
||||
│ Status open │
|
||||
|
|
@ -106,6 +108,7 @@ $ rad patch show --verbose 89f7afb
|
|||
│ Author alice (you) │
|
||||
│ Head 8945f6189adf027892c85ac57f7e9341049c2537 │
|
||||
│ Base f2de534b5e81d7c6e2dcaf58c3dd91573c0a0354 │
|
||||
│ Target refs/heads/master │
|
||||
│ Branches changes │
|
||||
│ Commits ahead 2, behind 0 │
|
||||
│ Status open │
|
||||
|
|
@ -164,6 +167,7 @@ $ rad patch show 89f7afb
|
|||
│ Author alice (you) │
|
||||
│ Head f1339dd109e538c6b3a7fed3e72403e1b4db08c9 │
|
||||
│ Base [.. ] │
|
||||
│ Target master │
|
||||
│ Branches changes │
|
||||
│ Commits ahead 3, behind 0 │
|
||||
│ Status open │
|
||||
|
|
|
|||
|
|
@ -89,6 +89,7 @@ $ rad patch show 696ec5508494692899337afe6713fe1796d0315c
|
|||
│ Author alice (you) │
|
||||
│ Head 20aa5dde6210796c3a2f04079b42316a31d02689 │
|
||||
│ Base [.. ] │
|
||||
│ Target master │
|
||||
│ Branches feature/1 │
|
||||
│ Commits ahead 0, behind 2 │
|
||||
│ Status merged │
|
||||
|
|
@ -105,6 +106,7 @@ $ rad patch show 356f73863a8920455ff6e77cd9c805d68910551b
|
|||
│ Author alice (you) │
|
||||
│ Head daf349ff76bedf48c5f292290b682ee7be0683cf │
|
||||
│ Base [.. ] │
|
||||
│ Target master │
|
||||
│ Branches feature/2 │
|
||||
│ Commits ahead 0, behind 2 │
|
||||
│ Status merged │
|
||||
|
|
|
|||
|
|
@ -62,6 +62,7 @@ $ rad patch show -v -p 217f050
|
|||
│ Author alice (you) │
|
||||
│ Head 5c88a79d75f5c2b4cc51ee6f163d2db91ee198d7 │
|
||||
│ Base f64fb2c8fe28f7c458c72ec8d700373924794943 │
|
||||
│ Target refs/heads/master │
|
||||
│ Branches feature/1 │
|
||||
│ Commits ahead 1, behind 1 │
|
||||
│ Status open │
|
||||
|
|
@ -108,6 +109,7 @@ $ rad patch show -v e22ff008e2a0ed47262890d13263031d7555b555
|
|||
│ Author alice (you) │
|
||||
│ Head 7f63fcbcf23fc39eea784c091ad3d20d7e4bd005 │
|
||||
│ Base f64fb2c8fe28f7c458c72ec8d700373924794943 │
|
||||
│ Target refs/heads/master │
|
||||
│ Branches feature/2 │
|
||||
│ Commits ahead 2, behind 1 │
|
||||
│ Status open │
|
||||
|
|
@ -143,6 +145,7 @@ $ rad patch show -v a467ffa260c4fbe355b6fb550ba0c4956078717e
|
|||
│ Author alice (you) │
|
||||
│ Head 7f63fcbcf23fc39eea784c091ad3d20d7e4bd005 │
|
||||
│ Base 5c88a79d75f5c2b4cc51ee6f163d2db91ee198d7 │
|
||||
│ Target refs/heads/master │
|
||||
│ Branches feature/2 │
|
||||
│ Commits ahead 2, behind 1 │
|
||||
│ Status open │
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@ $ rad patch show 183d343ab47d7fe18baf1b24b7209ad033d7fe5c
|
|||
│ Author alice (you) │
|
||||
│ Head 27857ec9eb04c69cacab516e8bf4b5fd36090f66 │
|
||||
│ Base f2de534b5e81d7c6e2dcaf58c3dd91573c0a0354 │
|
||||
│ Target master │
|
||||
│ Branches add-readme │
|
||||
│ Commits ahead 2, behind 0 │
|
||||
│ Status open │
|
||||
|
|
@ -81,6 +82,7 @@ $ rad patch show 183d343
|
|||
│ Author alice (you) │
|
||||
│ Head 27857ec9eb04c69cacab516e8bf4b5fd36090f66 │
|
||||
│ Base 3e674d1a1df90807e934f9ae5da2591dd6848a33 │
|
||||
│ Target master │
|
||||
│ Branches add-readme │
|
||||
│ Commits ahead 2, behind 0 │
|
||||
│ Status open │
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ $ rad patch show aa45913
|
|||
│ Author alice (you) │
|
||||
│ Head 639f44a25145a37f747f3c84265037a9461e44c5 │
|
||||
│ Base [.. ] │
|
||||
│ Target master │
|
||||
│ Branches patch/aa45913 │
|
||||
│ Commits ahead 3, behind 0 │
|
||||
│ Status open │
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ $ rad patch show 6c61ef1 -v
|
|||
│ Author alice (you) │
|
||||
│ Head 717c900ec17735639587325e0fd9fe09991c9edd │
|
||||
│ Base f2de534b5e81d7c6e2dcaf58c3dd91573c0a0354 │
|
||||
│ Target refs/heads/master │
|
||||
│ Branches prepare-license │
|
||||
│ Commits ahead 1, behind 0 │
|
||||
│ Status draft │
|
||||
|
|
@ -90,6 +91,7 @@ $ rad patch show 6c61ef1 -v
|
|||
│ Author alice z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi │
|
||||
│ Head 1cc8cd9de8ccc44b4fe3876f2dbd2cd1cf9ddc0e │
|
||||
│ Base f2de534b5e81d7c6e2dcaf58c3dd91573c0a0354 │
|
||||
│ Target refs/heads/master │
|
||||
│ Commits ahead 2, behind 0 │
|
||||
│ Status draft │
|
||||
├─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
|
||||
|
|
@ -115,6 +117,7 @@ $ rad patch show 6c61ef1 -v
|
|||
│ Author alice (you) │
|
||||
│ Head 1cc8cd9de8ccc44b4fe3876f2dbd2cd1cf9ddc0e │
|
||||
│ Base f2de534b5e81d7c6e2dcaf58c3dd91573c0a0354 │
|
||||
│ Target refs/heads/master │
|
||||
│ Branches prepare-license │
|
||||
│ Commits ahead 2, behind 0 │
|
||||
│ Status draft │
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ $ rad patch show 97e18f8598237a396a1c0ac1509c89028e666c97
|
|||
│ Author alice (you) │
|
||||
│ Head 2a465832b5a76abe25be44a3a5d224bbd7741ba7 │
|
||||
│ Base [.. ] │
|
||||
│ Target master │
|
||||
│ Branches cloudhead/draft │
|
||||
│ Commits ahead 1, behind 0 │
|
||||
│ Status draft │
|
||||
|
|
@ -48,6 +49,7 @@ $ rad patch show 97e18f8598237a396a1c0ac1509c89028e666c97
|
|||
│ Author alice (you) │
|
||||
│ Head 2a465832b5a76abe25be44a3a5d224bbd7741ba7 │
|
||||
│ Base [.. ] │
|
||||
│ Target master │
|
||||
│ Branches cloudhead/draft │
|
||||
│ Commits ahead 1, behind 0 │
|
||||
│ Status open │
|
||||
|
|
@ -70,6 +72,7 @@ $ rad patch show 97e18f8598237a396a1c0ac1509c89028e666c97
|
|||
│ Author alice (you) │
|
||||
│ Head 2a465832b5a76abe25be44a3a5d224bbd7741ba7 │
|
||||
│ Base [.. ] │
|
||||
│ Target master │
|
||||
│ Branches cloudhead/draft │
|
||||
│ Commits ahead 1, behind 0 │
|
||||
│ Status draft │
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@ $ rad patch show 89f7afb
|
|||
│ Author alice (you) │
|
||||
│ Head 8945f6189adf027892c85ac57f7e9341049c2537 │
|
||||
│ Base [.. ] │
|
||||
│ Target master │
|
||||
│ Branches changes │
|
||||
│ Commits ahead 2, behind 0 │
|
||||
│ Status open │
|
||||
|
|
@ -75,6 +76,7 @@ $ rad patch show 89f7afb
|
|||
│ Author alice (you) │
|
||||
│ Head 8945f6189adf027892c85ac57f7e9341049c2537 │
|
||||
│ Base [.. ] │
|
||||
│ Target master │
|
||||
│ Branches changes │
|
||||
│ Commits ahead 2, behind 0 │
|
||||
│ Status open │
|
||||
|
|
@ -104,6 +106,7 @@ $ rad patch show 89f7afb
|
|||
│ Author alice (you) │
|
||||
│ Head 8945f6189adf027892c85ac57f7e9341049c2537 │
|
||||
│ Base [.. ] │
|
||||
│ Target master │
|
||||
│ Branches changes │
|
||||
│ Commits ahead 2, behind 0 │
|
||||
│ Status open │
|
||||
|
|
|
|||
|
|
@ -68,6 +68,7 @@ $ rad patch show 1e31055 -p
|
|||
│ Author alice (you) │
|
||||
│ Head a6ea7b7[.. ] │
|
||||
│ Base f2de534[.. ] │
|
||||
│ Target master │
|
||||
│ Commits ahead 1, behind 0 │
|
||||
│ Status open │
|
||||
│ │
|
||||
|
|
|
|||
|
|
@ -52,6 +52,7 @@ $ rad patch show 01dad54
|
|||
│ Author alice (you) │
|
||||
│ Head 46fd342edc149468ec08b0b25291083aa05d4449 │
|
||||
│ Base [.. ] │
|
||||
│ Target accepted │
|
||||
│ Branches feature/1 │
|
||||
│ Commits ahead 1, behind 0 │
|
||||
│ Status open │
|
||||
|
|
@ -102,6 +103,7 @@ $ rad patch show 01dad54
|
|||
│ Author alice (you) │
|
||||
│ Head 46fd342edc149468ec08b0b25291083aa05d4449 │
|
||||
│ Base [.. ] │
|
||||
│ Target accepted │
|
||||
│ Branches accepted, feature/1 │
|
||||
│ Commits up to date │
|
||||
│ Status merged │
|
||||
|
|
@ -151,6 +153,7 @@ $ rad patch show 965855f
|
|||
│ Author alice (you) │
|
||||
│ Head 7e6814e99fe7084a213faeb69ca1eacc26935e3c │
|
||||
│ Base f2de534b5e81d7c6e2dcaf58c3dd91573c0a0354 │
|
||||
│ Target accepted │
|
||||
│ Branches feature/2 │
|
||||
│ Commits ahead 1, behind 0 │
|
||||
│ Status open │
|
||||
|
|
@ -191,6 +194,7 @@ $ rad patch show c846bb5 -v
|
|||
│ Author alice (you) │
|
||||
│ Head 99c1d5a04c17ba854f1f4d59985c980c0faf16e7 │
|
||||
│ Base f2de534b5e81d7c6e2dcaf58c3dd91573c0a0354 │
|
||||
│ Target refs/heads/accepted │
|
||||
│ Branches feature/3 │
|
||||
│ Commits ahead 2, behind 0 │
|
||||
│ Status open │
|
||||
|
|
|
|||
|
|
@ -103,6 +103,7 @@ $ rad patch show 55b9721
|
|||
│ Author bob z6Mkt67…v4N1tRk │
|
||||
│ Head cad2666a8a2250e4dee175ed5044be2c251ff08b │
|
||||
│ Base [.. ] │
|
||||
│ Target master │
|
||||
│ Commits ahead 2, behind 0 │
|
||||
│ Status open │
|
||||
├──────────────────────────────────────────────────────────────────┤
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ $ rad patch show 696ec5508494692899337afe6713fe1796d0315c
|
|||
│ Author alice (you) │
|
||||
│ Head 20aa5dde6210796c3a2f04079b42316a31d02689 │
|
||||
│ Base [.. ] │
|
||||
│ Target master │
|
||||
│ Branches feature/1, master │
|
||||
│ Commits up to date │
|
||||
│ Status merged │
|
||||
|
|
@ -66,6 +67,7 @@ $ rad patch show 696ec5508494692899337afe6713fe1796d0315c
|
|||
│ Author alice (you) │
|
||||
│ Head 20aa5dde6210796c3a2f04079b42316a31d02689 │
|
||||
│ Base [.. ] │
|
||||
│ Target master │
|
||||
│ Branches feature/1 │
|
||||
│ Commits ahead 1, behind 0 │
|
||||
│ Status open │
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ $ rad patch show b6a23eb08656de0ef1fcc0b5fe8820841e5cb2e5
|
|||
│ Author alice (you) │
|
||||
│ Head 51b2f0f77b9849bfaa3e9d3ff68ee2f57771d20c │
|
||||
│ Base [.. ] │
|
||||
│ Target master │
|
||||
│ Branches feature/1 │
|
||||
│ Commits ahead 1, behind 0 │
|
||||
│ Status open │
|
||||
|
|
@ -61,6 +62,7 @@ $ rad patch show b6a23eb08656de0ef1fcc0b5fe8820841e5cb2e5
|
|||
│ Author alice (you) │
|
||||
│ Head 4d272148458a17620541555b1f0905c01658aa9f │
|
||||
│ Base [.. ] │
|
||||
│ Target master │
|
||||
│ Branches feature/1 │
|
||||
│ Commits ahead 2, behind 0 │
|
||||
│ Status open │
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ $ rad patch show 6035d2f582afbe01ff23ea87528ae523d76875b6
|
|||
│ Author alice (you) │
|
||||
│ Head 42d894a83c9c356552a57af09ccdbd5587a99045 │
|
||||
│ Base [.. ] │
|
||||
│ Target master │
|
||||
│ Branches feature/1 │
|
||||
│ Commits ahead 1, behind 0 │
|
||||
│ Status open │
|
||||
|
|
@ -144,6 +145,7 @@ $ rad patch show 9580891
|
|||
│ Author alice (you) │
|
||||
│ Head 02bef3fac41b2f98bb3c02b868a53ddfecb55b5f │
|
||||
│ Base [.. ] │
|
||||
│ Target master │
|
||||
│ Branches feature/2 │
|
||||
│ Commits ahead 2, behind 0 │
|
||||
│ Status open │
|
||||
|
|
@ -225,6 +227,7 @@ $ rad patch show 9580891
|
|||
│ Author alice (you) │
|
||||
│ Head 9304dbc445925187994a7a93222a3f8bde73b785 │
|
||||
│ Base [.. ] │
|
||||
│ Target master │
|
||||
│ Branches feature/2 │
|
||||
│ Commits ahead 2, behind 0 │
|
||||
│ Status open │
|
||||
|
|
|
|||
|
|
@ -49,6 +49,7 @@ $ rad patch show aa45913e757cacd46972733bddee5472c78fa32a -p
|
|||
│ Author alice (you) │
|
||||
│ Head 3e674d1a1df90807e934f9ae5da2591dd6848a33 │
|
||||
│ Base [.. ] │
|
||||
│ Target master │
|
||||
│ Branches flux-capacitor-power │
|
||||
│ Commits ahead 1, behind 0 │
|
||||
│ Status open │
|
||||
|
|
@ -104,6 +105,7 @@ $ rad patch show aa45913
|
|||
│ Labels fun │
|
||||
│ Head 3e674d1a1df90807e934f9ae5da2591dd6848a33 │
|
||||
│ Base [.. ] │
|
||||
│ Target master │
|
||||
│ Branches flux-capacitor-power │
|
||||
│ Commits ahead 1, behind 0 │
|
||||
│ Status open │
|
||||
|
|
@ -192,6 +194,7 @@ $ rad patch show aa45913
|
|||
│ Labels fun │
|
||||
│ Head 27857ec9eb04c69cacab516e8bf4b5fd36090f66 │
|
||||
│ Base [.. ] │
|
||||
│ Target master │
|
||||
│ Branches flux-capacitor-power, patch/aa45913 │
|
||||
│ Commits ahead 2, behind 0 │
|
||||
│ Status open │
|
||||
|
|
@ -225,6 +228,7 @@ $ rad patch show aa45913
|
|||
│ Labels fun │
|
||||
│ Head 27857ec9eb04c69cacab516e8bf4b5fd36090f66 │
|
||||
│ Base [.. ] │
|
||||
│ Target master │
|
||||
│ Branches flux-capacitor-power, patch/aa45913 │
|
||||
│ Commits ahead 2, behind 0 │
|
||||
│ Status open │
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@ $ rad patch show e4934b6d9dbe01ce3c7fbb5b77a80d5f1dacdc46
|
|||
│ Author bob (you) │
|
||||
│ Head 3e674d1a1df90807e934f9ae5da2591dd6848a33 │
|
||||
│ Base [.. ] │
|
||||
│ Target master │
|
||||
│ Branches flux-capacitor-power │
|
||||
│ Commits ahead 1, behind 0 │
|
||||
│ Status open │
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ $ rad patch show e4934b6
|
|||
│ Author bob z6Mkt67…v4N1tRk │
|
||||
│ Head 27857ec9eb04c69cacab516e8bf4b5fd36090f66 │
|
||||
│ Base [.. ] │
|
||||
│ Target master │
|
||||
│ Commits ahead 2, behind 0 │
|
||||
│ Status open │
|
||||
│ │
|
||||
|
|
@ -109,6 +110,7 @@ $ rad patch show e4934b6
|
|||
│ Author bob z6Mkt67…v4N1tRk │
|
||||
│ Head 27857ec9eb04c69cacab516e8bf4b5fd36090f66 │
|
||||
│ Base [.. ] │
|
||||
│ Target master │
|
||||
│ Commits ahead 0, behind 1 │
|
||||
│ Status merged │
|
||||
│ │
|
||||
|
|
|
|||
|
|
@ -14,8 +14,8 @@ use radicle::cob::patch;
|
|||
use radicle::git;
|
||||
use radicle::patch::{Patch, PatchId};
|
||||
use radicle::prelude::Profile;
|
||||
use radicle::storage::WriteRepository as _;
|
||||
use radicle::storage::git::Repository;
|
||||
use radicle::storage::{ReadRepository, WriteRepository as _};
|
||||
|
||||
use crate::terminal as term;
|
||||
use crate::terminal::Element;
|
||||
|
|
@ -373,6 +373,18 @@ pub fn show(
|
|||
let author = term::format::Author::new(author.id(), profile, verbose);
|
||||
let labels = patch.labels().map(|l| l.to_string()).collect::<Vec<_>>();
|
||||
|
||||
let doc = stored.identity_doc()?;
|
||||
let target = patch.merge_target_branch(&doc)?;
|
||||
let target_branch = if verbose {
|
||||
target.to_string()
|
||||
} else {
|
||||
target
|
||||
.as_str()
|
||||
.strip_prefix("refs/heads/")
|
||||
.unwrap_or(target.as_str())
|
||||
.to_string()
|
||||
};
|
||||
|
||||
let mut attrs = term::Table::<2, term::Line>::new(term::TableOptions {
|
||||
spacing: 2,
|
||||
..term::TableOptions::default()
|
||||
|
|
@ -403,6 +415,10 @@ pub fn show(
|
|||
term::format::tertiary("Base".to_owned()).into(),
|
||||
term::format::secondary(revision.base().to_string()).into(),
|
||||
]);
|
||||
attrs.push([
|
||||
term::format::tertiary("Target".to_owned()).into(),
|
||||
term::format::secondary(target_branch).into(),
|
||||
]);
|
||||
if !branches.is_empty() {
|
||||
attrs.push([
|
||||
term::format::tertiary("Branches".to_owned()).into(),
|
||||
|
|
|
|||
Loading…
Reference in New Issue