diff --git a/cli/src/commands/checkout.rs b/cli/src/commands/checkout.rs index ce826b95ec9..ba212dc7fd3 100644 --- a/cli/src/commands/checkout.rs +++ b/cli/src/commands/checkout.rs @@ -45,7 +45,11 @@ pub(crate) fn cmd_checkout( ui.warning(), "warning: `jj checkout` is deprecated; use `jj new` instead, which is equivalent" )?; - let mut workspace_command = command.workspace_helper(ui)?; + writeln!( + ui.hint(), + r#"Run e.g. `jj config set --user aliases.co '["new"]'` to disable this message."# + )?; +let mut workspace_command = command.workspace_helper(ui)?; let target = workspace_command.resolve_single_rev(&args.revision)?; let mut tx = workspace_command.start_transaction(); let commit_builder = tx diff --git a/cli/tests/test_checkout.rs b/cli/tests/test_checkout.rs index 45283208629..311c76ae2e1 100644 --- a/cli/tests/test_checkout.rs +++ b/cli/tests/test_checkout.rs @@ -30,6 +30,7 @@ fn test_checkout() { insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stderr, @r###" warning: `jj checkout` is deprecated; use `jj new` instead, which is equivalent + Run e.g. `jj config set --user aliases.co '["new"]'` to disable this message. Working copy now at: zsuskuln 05ce7118 (empty) (no description set) Parent commit : rlvkpnrz 5c52832c (empty) second "###); @@ -66,6 +67,7 @@ fn test_checkout_not_single_rev() { let stderr = test_env.jj_cmd_failure(&repo_path, &["checkout", "root()..@"]); insta::assert_snapshot!(stderr, @r###" warning: `jj checkout` is deprecated; use `jj new` instead, which is equivalent + Run e.g. `jj config set --user aliases.co '["new"]'` to disable this message. Error: Revset "root()..@" resolved to more than one revision Hint: The revset "root()..@" resolved to these revisions: royxmykx 2f859371 (empty) (no description set) @@ -79,6 +81,7 @@ fn test_checkout_not_single_rev() { let stderr = test_env.jj_cmd_failure(&repo_path, &["checkout", "root()..@-"]); insta::assert_snapshot!(stderr, @r###" warning: `jj checkout` is deprecated; use `jj new` instead, which is equivalent + Run e.g. `jj config set --user aliases.co '["new"]'` to disable this message. Error: Revset "root()..@-" resolved to more than one revision Hint: The revset "root()..@-" resolved to these revisions: mzvwutvl 5c1afd8b (empty) fifth @@ -91,6 +94,7 @@ fn test_checkout_not_single_rev() { let stderr = test_env.jj_cmd_failure(&repo_path, &["checkout", "@-|@--"]); insta::assert_snapshot!(stderr, @r###" warning: `jj checkout` is deprecated; use `jj new` instead, which is equivalent + Run e.g. `jj config set --user aliases.co '["new"]'` to disable this message. Error: Revset "@-|@--" resolved to more than one revision Hint: The revset "@-|@--" resolved to these revisions: mzvwutvl 5c1afd8b (empty) fifth @@ -100,6 +104,7 @@ fn test_checkout_not_single_rev() { let stderr = test_env.jj_cmd_failure(&repo_path, &["checkout", "none()"]); insta::assert_snapshot!(stderr, @r###" warning: `jj checkout` is deprecated; use `jj new` instead, which is equivalent + Run e.g. `jj config set --user aliases.co '["new"]'` to disable this message. Error: Revset "none()" didn't resolve to any revisions "###); }