diff --git a/crates/radicle-cli/examples/rad-cob-update.md b/crates/radicle-cli/examples/rad-cob-update.md index df30521a..efd6682b 100644 --- a/crates/radicle-cli/examples/rad-cob-update.md +++ b/crates/radicle-cli/examples/rad-cob-update.md @@ -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 │ diff --git a/crates/radicle-cli/examples/rad-merge-via-push.md b/crates/radicle-cli/examples/rad-merge-via-push.md index 65930037..d8d5e40e 100644 --- a/crates/radicle-cli/examples/rad-merge-via-push.md +++ b/crates/radicle-cli/examples/rad-merge-via-push.md @@ -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 │ diff --git a/crates/radicle-cli/examples/rad-patch-ahead-behind.md b/crates/radicle-cli/examples/rad-patch-ahead-behind.md index 1081ae5e..c9b2be25 100644 --- a/crates/radicle-cli/examples/rad-patch-ahead-behind.md +++ b/crates/radicle-cli/examples/rad-patch-ahead-behind.md @@ -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 │ diff --git a/crates/radicle-cli/examples/rad-patch-change-base.md b/crates/radicle-cli/examples/rad-patch-change-base.md index de6c12cc..e7a55cdf 100644 --- a/crates/radicle-cli/examples/rad-patch-change-base.md +++ b/crates/radicle-cli/examples/rad-patch-change-base.md @@ -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 │ diff --git a/crates/radicle-cli/examples/rad-patch-checkout-revision.md b/crates/radicle-cli/examples/rad-patch-checkout-revision.md index 4a0e6f35..f045d3ab 100644 --- a/crates/radicle-cli/examples/rad-patch-checkout-revision.md +++ b/crates/radicle-cli/examples/rad-patch-checkout-revision.md @@ -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 │ diff --git a/crates/radicle-cli/examples/rad-patch-delete.md b/crates/radicle-cli/examples/rad-patch-delete.md index c635d887..47bcecec 100644 --- a/crates/radicle-cli/examples/rad-patch-delete.md +++ b/crates/radicle-cli/examples/rad-patch-delete.md @@ -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 │ diff --git a/crates/radicle-cli/examples/rad-patch-draft.md b/crates/radicle-cli/examples/rad-patch-draft.md index 2ce5200f..adc502ec 100644 --- a/crates/radicle-cli/examples/rad-patch-draft.md +++ b/crates/radicle-cli/examples/rad-patch-draft.md @@ -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 │ diff --git a/crates/radicle-cli/examples/rad-patch-edit.md b/crates/radicle-cli/examples/rad-patch-edit.md index 9250ed77..a2cd09d3 100644 --- a/crates/radicle-cli/examples/rad-patch-edit.md +++ b/crates/radicle-cli/examples/rad-patch-edit.md @@ -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 │ diff --git a/crates/radicle-cli/examples/rad-patch-jj.md b/crates/radicle-cli/examples/rad-patch-jj.md index 80ac30eb..9c131dc8 100644 --- a/crates/radicle-cli/examples/rad-patch-jj.md +++ b/crates/radicle-cli/examples/rad-patch-jj.md @@ -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 │ │ │ diff --git a/crates/radicle-cli/examples/rad-patch-magic-push.md b/crates/radicle-cli/examples/rad-patch-magic-push.md index 6359aa15..2fa569dc 100644 --- a/crates/radicle-cli/examples/rad-patch-magic-push.md +++ b/crates/radicle-cli/examples/rad-patch-magic-push.md @@ -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 │ diff --git a/crates/radicle-cli/examples/rad-patch-pull-update.md b/crates/radicle-cli/examples/rad-patch-pull-update.md index c1cb08ba..8b562488 100644 --- a/crates/radicle-cli/examples/rad-patch-pull-update.md +++ b/crates/radicle-cli/examples/rad-patch-pull-update.md @@ -103,6 +103,7 @@ $ rad patch show 55b9721 │ Author bob z6Mkt67…v4N1tRk │ │ Head cad2666a8a2250e4dee175ed5044be2c251ff08b │ │ Base [.. ] │ +│ Target master │ │ Commits ahead 2, behind 0 │ │ Status open │ ├──────────────────────────────────────────────────────────────────┤ diff --git a/crates/radicle-cli/examples/rad-patch-revert-merge.md b/crates/radicle-cli/examples/rad-patch-revert-merge.md index de89f91e..a0c58d07 100644 --- a/crates/radicle-cli/examples/rad-patch-revert-merge.md +++ b/crates/radicle-cli/examples/rad-patch-revert-merge.md @@ -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 │ diff --git a/crates/radicle-cli/examples/rad-patch-update.md b/crates/radicle-cli/examples/rad-patch-update.md index db768266..67934e0b 100644 --- a/crates/radicle-cli/examples/rad-patch-update.md +++ b/crates/radicle-cli/examples/rad-patch-update.md @@ -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 │ diff --git a/crates/radicle-cli/examples/rad-patch-via-push.md b/crates/radicle-cli/examples/rad-patch-via-push.md index 98c39891..7d99aac6 100644 --- a/crates/radicle-cli/examples/rad-patch-via-push.md +++ b/crates/radicle-cli/examples/rad-patch-via-push.md @@ -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 │ diff --git a/crates/radicle-cli/examples/rad-patch.md b/crates/radicle-cli/examples/rad-patch.md index a68ff30c..875d7b39 100644 --- a/crates/radicle-cli/examples/rad-patch.md +++ b/crates/radicle-cli/examples/rad-patch.md @@ -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 │ diff --git a/crates/radicle-cli/examples/workflow/4-patching-contributor.md b/crates/radicle-cli/examples/workflow/4-patching-contributor.md index 32150846..d9d1d99e 100644 --- a/crates/radicle-cli/examples/workflow/4-patching-contributor.md +++ b/crates/radicle-cli/examples/workflow/4-patching-contributor.md @@ -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 │ diff --git a/crates/radicle-cli/examples/workflow/5-patching-maintainer.md b/crates/radicle-cli/examples/workflow/5-patching-maintainer.md index 2517cf36..a459df02 100644 --- a/crates/radicle-cli/examples/workflow/5-patching-maintainer.md +++ b/crates/radicle-cli/examples/workflow/5-patching-maintainer.md @@ -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 │ │ │ diff --git a/crates/radicle-cli/src/terminal/patch.rs b/crates/radicle-cli/src/terminal/patch.rs index 8472accc..b8d976b2 100644 --- a/crates/radicle-cli/src/terminal/patch.rs +++ b/crates/radicle-cli/src/terminal/patch.rs @@ -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::>(); + 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(),