mirror of
https://github.com/martinvonz/jj.git
synced 2025-02-07 21:27:06 +00:00
cli: exit with CLI error status on "op abandon --at-op"
The command option --at-op isn't supported by "op abandon", so it's rather a CLI error.
This commit is contained in:
parent
b9e82f6e06
commit
c705afa299
2 changed files with 3 additions and 3 deletions
|
@ -21,7 +21,7 @@ use jj_lib::op_walk;
|
||||||
use jj_lib::operation::Operation;
|
use jj_lib::operation::Operation;
|
||||||
|
|
||||||
use crate::cli_util::{short_operation_hash, CommandHelper};
|
use crate::cli_util::{short_operation_hash, CommandHelper};
|
||||||
use crate::command_error::{user_error, user_error_with_hint, CommandError};
|
use crate::command_error::{cli_error, user_error, user_error_with_hint, CommandError};
|
||||||
use crate::ui::Ui;
|
use crate::ui::Ui;
|
||||||
|
|
||||||
/// Abandon operation history
|
/// Abandon operation history
|
||||||
|
@ -55,7 +55,7 @@ pub fn cmd_op_abandon(
|
||||||
// with the current head.
|
// with the current head.
|
||||||
let head_op_str = &command.global_args().at_operation;
|
let head_op_str = &command.global_args().at_operation;
|
||||||
if head_op_str != "@" {
|
if head_op_str != "@" {
|
||||||
return Err(user_error("--at-op is not respected"));
|
return Err(cli_error("--at-op is not respected"));
|
||||||
}
|
}
|
||||||
let current_head_op = op_walk::resolve_op_for_load(repo_loader, head_op_str)?;
|
let current_head_op = op_walk::resolve_op_for_load(repo_loader, head_op_str)?;
|
||||||
let resolve_op = |op_str| op_walk::resolve_op_at(op_store, ¤t_head_op, op_str);
|
let resolve_op = |op_str| op_walk::resolve_op_at(op_store, ¤t_head_op, op_str);
|
||||||
|
|
|
@ -418,7 +418,7 @@ fn test_op_abandon_ancestors() {
|
||||||
"###);
|
"###);
|
||||||
|
|
||||||
// Can't create concurrent abandoned operations explicitly.
|
// Can't create concurrent abandoned operations explicitly.
|
||||||
let stderr = test_env.jj_cmd_failure(&repo_path, &["op", "abandon", "--at-op=@-", "@"]);
|
let stderr = test_env.jj_cmd_cli_error(&repo_path, &["op", "abandon", "--at-op=@-", "@"]);
|
||||||
insta::assert_snapshot!(stderr, @r###"
|
insta::assert_snapshot!(stderr, @r###"
|
||||||
Error: --at-op is not respected
|
Error: --at-op is not respected
|
||||||
"###);
|
"###);
|
||||||
|
|
Loading…
Reference in a new issue