cli: Add `-v` flag to `rad patch show`
With this flag, additional data such as the patch base is shown.
This commit is contained in:
parent
48f44f4af5
commit
a6782ac2d6
|
|
@ -55,12 +55,13 @@ $ rad patch list
|
||||||
When showing the patch, we see that it is `ahead 1, behind 1`, since master has
|
When showing the patch, we see that it is `ahead 1, behind 1`, since master has
|
||||||
diverged by one commit:
|
diverged by one commit:
|
||||||
```
|
```
|
||||||
$ rad patch show -p 866f59c
|
$ rad patch show -v -p 866f59c
|
||||||
╭────────────────────────────────────────────────────────────────────╮
|
╭────────────────────────────────────────────────────────────────────╮
|
||||||
│ Title Add Alan │
|
│ Title Add Alan │
|
||||||
│ Patch 866f59c001cd4d78a151f444b34265566c83c264 │
|
│ Patch 866f59c001cd4d78a151f444b34265566c83c264 │
|
||||||
│ Author did:key:z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi │
|
│ Author did:key:z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi │
|
||||||
│ Head 5c88a79d75f5c2b4cc51ee6f163d2db91ee198d7 │
|
│ Head 5c88a79d75f5c2b4cc51ee6f163d2db91ee198d7 │
|
||||||
|
│ Base f64fb2c8fe28f7c458c72ec8d700373924794943 │
|
||||||
│ Branches feature/1 │
|
│ Branches feature/1 │
|
||||||
│ Commits ahead 1, behind 1 │
|
│ Commits ahead 1, behind 1 │
|
||||||
│ Status open │
|
│ Status open │
|
||||||
|
|
@ -100,12 +101,13 @@ To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkE
|
||||||
When we look at the patch, we see that it has both commits, because this new
|
When we look at the patch, we see that it has both commits, because this new
|
||||||
patch uses the same base as the previous patch:
|
patch uses the same base as the previous patch:
|
||||||
```
|
```
|
||||||
$ rad patch show 57cb9b2758518e547de324456ac967fda456c6c1
|
$ rad patch show -v 57cb9b2758518e547de324456ac967fda456c6c1
|
||||||
╭────────────────────────────────────────────────────────────────────╮
|
╭────────────────────────────────────────────────────────────────────╮
|
||||||
│ Title Add Mel │
|
│ Title Add Mel │
|
||||||
│ Patch 57cb9b2758518e547de324456ac967fda456c6c1 │
|
│ Patch 57cb9b2758518e547de324456ac967fda456c6c1 │
|
||||||
│ Author did:key:z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi │
|
│ Author did:key:z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi │
|
||||||
│ Head 7f63fcbcf23fc39eea784c091ad3d20d7e4bd005 │
|
│ Head 7f63fcbcf23fc39eea784c091ad3d20d7e4bd005 │
|
||||||
|
│ Base f64fb2c8fe28f7c458c72ec8d700373924794943 │
|
||||||
│ Branches feature/2 │
|
│ Branches feature/2 │
|
||||||
│ Commits ahead 2, behind 1 │
|
│ Commits ahead 2, behind 1 │
|
||||||
│ Status open │
|
│ Status open │
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,7 @@ Usage
|
||||||
Show options
|
Show options
|
||||||
|
|
||||||
-p, --patch Show the actual patch diff
|
-p, --patch Show the actual patch diff
|
||||||
|
-v, --verbose Show additional information about the patch
|
||||||
|
|
||||||
Edit options
|
Edit options
|
||||||
|
|
||||||
|
|
@ -126,6 +127,7 @@ pub enum Operation {
|
||||||
Show {
|
Show {
|
||||||
patch_id: Rev,
|
patch_id: Rev,
|
||||||
diff: bool,
|
diff: bool,
|
||||||
|
verbose: bool,
|
||||||
},
|
},
|
||||||
Update {
|
Update {
|
||||||
patch_id: Option<Rev>,
|
patch_id: Option<Rev>,
|
||||||
|
|
@ -296,6 +298,7 @@ impl Args for Options {
|
||||||
OperationName::List => Operation::List { filter },
|
OperationName::List => Operation::List { filter },
|
||||||
OperationName::Show => Operation::Show {
|
OperationName::Show => Operation::Show {
|
||||||
patch_id: patch_id.ok_or_else(|| anyhow!("a patch must be provided"))?,
|
patch_id: patch_id.ok_or_else(|| anyhow!("a patch must be provided"))?,
|
||||||
|
verbose,
|
||||||
diff,
|
diff,
|
||||||
},
|
},
|
||||||
OperationName::Delete => Operation::Delete {
|
OperationName::Delete => Operation::Delete {
|
||||||
|
|
@ -355,9 +358,13 @@ pub fn run(options: Options, ctx: impl term::Context) -> anyhow::Result<()> {
|
||||||
Operation::List { filter: Filter(f) } => {
|
Operation::List { filter: Filter(f) } => {
|
||||||
list::run(f, &repository, &profile)?;
|
list::run(f, &repository, &profile)?;
|
||||||
}
|
}
|
||||||
Operation::Show { patch_id, diff } => {
|
Operation::Show {
|
||||||
|
patch_id,
|
||||||
|
diff,
|
||||||
|
verbose,
|
||||||
|
} => {
|
||||||
let patch_id = patch_id.resolve(&repository.backend)?;
|
let patch_id = patch_id.resolve(&repository.backend)?;
|
||||||
show::run(&patch_id, diff, &profile, &repository, &workdir)?;
|
show::run(&patch_id, diff, verbose, &profile, &repository, &workdir)?;
|
||||||
}
|
}
|
||||||
Operation::Update {
|
Operation::Update {
|
||||||
ref patch_id,
|
ref patch_id,
|
||||||
|
|
|
||||||
|
|
@ -54,6 +54,7 @@ fn patch_commits(patch: &patch::Patch, stored: &Repository) -> anyhow::Result<Ve
|
||||||
pub fn run(
|
pub fn run(
|
||||||
patch_id: &PatchId,
|
patch_id: &PatchId,
|
||||||
diff: bool,
|
diff: bool,
|
||||||
|
verbose: bool,
|
||||||
profile: &Profile,
|
profile: &Profile,
|
||||||
stored: &Repository,
|
stored: &Repository,
|
||||||
// TODO: Should be optional.
|
// TODO: Should be optional.
|
||||||
|
|
@ -92,6 +93,12 @@ pub fn run(
|
||||||
term::format::tertiary("Head".to_owned()).into(),
|
term::format::tertiary("Head".to_owned()).into(),
|
||||||
term::format::secondary(revision.head().to_string()).into(),
|
term::format::secondary(revision.head().to_string()).into(),
|
||||||
]);
|
]);
|
||||||
|
if verbose {
|
||||||
|
attrs.push([
|
||||||
|
term::format::tertiary("Base".to_owned()).into(),
|
||||||
|
term::format::secondary(revision.base().to_string()).into(),
|
||||||
|
]);
|
||||||
|
}
|
||||||
if !branches.is_empty() {
|
if !branches.is_empty() {
|
||||||
attrs.push([
|
attrs.push([
|
||||||
term::format::tertiary("Branches".to_owned()).into(),
|
term::format::tertiary("Branches".to_owned()).into(),
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue