From 31525705db0572181e59ba03562f219224c5a4c0 Mon Sep 17 00:00:00 2001 From: Yuya Nishihara Date: Sun, 24 Mar 2024 15:47:47 +0900 Subject: [PATCH] cli: add "Hint: " or "Warning: " heading to almost all messages It's inconsistent that some warnings have headings and some don't, and it seems the choice is arbitrary. Let's unify the style. There are two exceptions: 1. continued line following labeled message, 2. "unrecognized response" followed by prompt. --- cli/src/cli_util.rs | 10 +++++----- cli/src/commands/branch.rs | 10 +++++----- cli/src/commands/commit.rs | 2 +- cli/src/commands/config.rs | 4 ++-- cli/src/commands/git.rs | 12 ++++++------ cli/src/commands/operation.rs | 2 +- cli/src/commands/split.rs | 2 +- cli/src/git_util.rs | 2 +- cli/src/merge_tools/external.rs | 2 +- cli/src/merge_tools/mod.rs | 2 +- cli/src/revset_util.rs | 2 +- cli/src/ui.rs | 2 +- cli/tests/test_alias.rs | 4 ++-- cli/tests/test_branch_command.rs | 26 +++++++++++++------------- cli/tests/test_commit_command.rs | 2 +- cli/tests/test_config_command.rs | 2 +- cli/tests/test_diff_command.rs | 2 +- cli/tests/test_git_colocated.rs | 4 ++-- cli/tests/test_git_fetch.rs | 2 +- cli/tests/test_git_import_export.rs | 2 +- cli/tests/test_git_init.rs | 2 +- cli/tests/test_git_push.rs | 24 ++++++++++++------------ cli/tests/test_gitignores.rs | 2 +- cli/tests/test_global_opts.rs | 4 ++-- cli/tests/test_init_command.rs | 2 +- cli/tests/test_operations.rs | 2 +- cli/tests/test_resolve_command.rs | 6 +++--- cli/tests/test_revset_output.rs | 4 ++-- cli/tests/test_split_command.rs | 2 +- cli/tests/test_templater.rs | 2 +- 30 files changed, 73 insertions(+), 73 deletions(-) diff --git a/cli/src/cli_util.rs b/cli/src/cli_util.rs index 5d9c98741..b6f1d1fa1 100644 --- a/cli/src/cli_util.rs +++ b/cli/src/cli_util.rs @@ -1210,7 +1210,7 @@ See https://github.com/martinvonz/jj/blob/main/docs/working-copy.md#stale-workin let settings = &self.settings; if settings.user_name().is_empty() || settings.user_email().is_empty() { writeln!( - ui.warning_no_heading(), + ui.warning_default(), r#"Name and email not configured. Until configured, your commits will be created with the empty identity, and can't be pushed to remotes. To configure, run: jj config set --user user.name "Some One" jj config set --user user.email "someone@example.com""# @@ -1596,7 +1596,7 @@ pub fn print_checkout_stats( } if stats.skipped_files != 0 { writeln!( - ui.warning_no_heading(), + ui.warning_default(), "{} of those updates were skipped because there were conflicting changes in the \ working copy.", stats.skipped_files @@ -1629,7 +1629,7 @@ pub fn print_trackable_remote_branches(ui: &Ui, view: &View) -> io::Result<()> { } writeln!( - ui.hint_no_heading(), + ui.hint_default(), "The following remote branches aren't associated with the existing local branches:" )?; let mut formatter = ui.stderr_formatter(); @@ -1740,7 +1740,7 @@ fn load_template_aliases( .and_then(|v| aliases_map.insert(&decl, v).map_err(|e| e.to_string())); if let Err(s) = r { writeln!( - ui.warning_no_heading(), + ui.warning_default(), r#"Failed to load "{TABLE_KEY}.{decl}": {s}"# )?; } @@ -2552,7 +2552,7 @@ impl CliRunner { let new_string_args = expand_args(ui, &self.app, env::args_os(), &config).ok(); if new_string_args.as_ref() != Some(&string_args) { writeln!( - ui.warning_no_heading(), + ui.warning_default(), "Command aliases cannot be loaded from -R/--repository path" )?; } diff --git a/cli/src/commands/branch.rs b/cli/src/commands/branch.rs index b4224ed32..4520e16fe 100644 --- a/cli/src/commands/branch.rs +++ b/cli/src/commands/branch.rs @@ -487,7 +487,7 @@ fn cmd_branch_delete( let view = workspace_command.repo().view(); if !args.glob.is_empty() { writeln!( - ui.warning_no_heading(), + ui.warning_default(), "--glob has been deprecated. Please prefix the pattern with `glob:` instead." )?; } @@ -514,7 +514,7 @@ fn cmd_branch_forget( let view = workspace_command.repo().view(); if !args.glob.is_empty() { writeln!( - ui.warning_no_heading(), + ui.warning_default(), "--glob has been deprecated. Please prefix the pattern with `glob:` instead." )?; } @@ -542,7 +542,7 @@ fn cmd_branch_track( for (name, remote_ref) in find_remote_branches(view, &args.names)? { if remote_ref.is_tracking() { writeln!( - ui.warning_no_heading(), + ui.warning_default(), "Remote branch already tracked: {name}" )?; } else { @@ -577,12 +577,12 @@ fn cmd_branch_untrack( if name.remote == git::REMOTE_NAME_FOR_LOCAL_GIT_REPO { // This restriction can be lifted if we want to support untracked @git branches. writeln!( - ui.warning_no_heading(), + ui.warning_default(), "Git-tracking branch cannot be untracked: {name}" )?; } else if !remote_ref.is_tracking() { writeln!( - ui.warning_no_heading(), + ui.warning_default(), "Remote branch not tracked yet: {name}" )?; } else { diff --git a/cli/src/commands/commit.rs b/cli/src/commands/commit.rs index 8d54ad5da..2ad459046 100644 --- a/cli/src/commands/commit.rs +++ b/cli/src/commands/commit.rs @@ -78,7 +78,7 @@ new working-copy commit. let middle_tree = tx.repo().store().get_root_tree(&tree_id)?; if !args.paths.is_empty() && middle_tree.id() == base_tree.id() { writeln!( - ui.warning_no_heading(), + ui.warning_default(), "The given paths do not match any file: {}", args.paths.join(" ") )?; diff --git a/cli/src/commands/config.rs b/cli/src/commands/config.rs index 366ce64e0..b9224a26c 100644 --- a/cli/src/commands/config.rs +++ b/cli/src/commands/config.rs @@ -257,9 +257,9 @@ pub(crate) fn cmd_config_list( if !wrote_values { // Note to stderr explaining why output is empty. if let Some(name) = &args.name { - writeln!(ui.warning_no_heading(), "No matching config key for {name}")?; + writeln!(ui.warning_default(), "No matching config key for {name}")?; } else { - writeln!(ui.warning_no_heading(), "No config to list")?; + writeln!(ui.warning_default(), "No config to list")?; } } Ok(()) diff --git a/cli/src/commands/git.rs b/cli/src/commands/git.rs index 90dd85596..c186dc7f0 100644 --- a/cli/src/commands/git.rs +++ b/cli/src/commands/git.rs @@ -597,7 +597,7 @@ fn get_default_fetch_remotes( // if nothing was explicitly configured, try to guess if remote != DEFAULT_REMOTE { writeln!( - ui.hint_no_heading(), + ui.hint_default(), "Fetching from the only existing remote: {remote}" )?; } @@ -703,7 +703,7 @@ fn cmd_git_clone( }; if let Err(err) = clean_up_dirs() { writeln!( - ui.warning_no_heading(), + ui.warning_default(), "Failed to clean up {}: {}", canonical_wc_path.display(), err @@ -1040,7 +1040,7 @@ fn get_default_push_remote( // similar to get_default_fetch_remotes if remote != DEFAULT_REMOTE { writeln!( - ui.hint_no_heading(), + ui.hint_default(), "Pushing to the only existing remote: {remote}" )?; } @@ -1058,7 +1058,7 @@ struct RejectedBranchUpdateReason { impl RejectedBranchUpdateReason { fn print(&self, ui: &Ui) -> io::Result<()> { - writeln!(ui.warning_no_heading(), "{}", self.message)?; + writeln!(ui.warning_default(), "{}", self.message)?; if let Some(hint) = &self.hint { writeln!(ui.hint_default(), "{hint}")?; } @@ -1197,7 +1197,7 @@ fn find_branches_targeted_by_revisions<'a>( revision_commit_ids.extend(current_branches_revset.iter()); if revision_commit_ids.is_empty() { writeln!( - ui.warning_no_heading(), + ui.warning_default(), "No branches found in the default push revset: \ remote_branches(remote={remote_name})..@" )?; @@ -1212,7 +1212,7 @@ fn find_branches_targeted_by_revisions<'a>( if commit_ids.peek().is_none() { let rev_str: &str = rev_str; writeln!( - ui.warning_no_heading(), + ui.warning_default(), "No branches point to the specified revisions: {rev_str}" )?; } diff --git a/cli/src/commands/operation.rs b/cli/src/commands/operation.rs index 8f05b4215..608919291 100644 --- a/cli/src/commands/operation.rs +++ b/cli/src/commands/operation.rs @@ -383,7 +383,7 @@ fn cmd_op_abandon( let old_op_id = locked_ws.locked_wc().old_operation_id(); if old_op_id != current_head_op.id() { writeln!( - ui.warning_no_heading(), + ui.warning_default(), "The working copy operation {} is not updated because it differs from the repo {}.", short_operation_hash(old_op_id), short_operation_hash(current_head_op.id()), diff --git a/cli/src/commands/split.rs b/cli/src/commands/split.rs index 3d2cfbf8d..89e8cf367 100644 --- a/cli/src/commands/split.rs +++ b/cli/src/commands/split.rs @@ -94,7 +94,7 @@ don't make any changes, then the operation will be aborted. if selected_tree_id == base_tree.id() { // The user selected nothing, so the first commit will be empty. writeln!( - ui.warning_no_heading(), + ui.warning_default(), "The given paths do not match any file: {}", args.paths.join(" ") )?; diff --git a/cli/src/git_util.rs b/cli/src/git_util.rs index 71ced090c..5bd9db355 100644 --- a/cli/src/git_util.rs +++ b/cli/src/git_util.rs @@ -392,7 +392,7 @@ pub fn print_failed_git_export( failed_branches: &[FailedRefExport], ) -> Result<(), std::io::Error> { if !failed_branches.is_empty() { - writeln!(ui.warning_no_heading(), "Failed to export some branches:")?; + writeln!(ui.warning_default(), "Failed to export some branches:")?; let mut formatter = ui.stderr_formatter(); for FailedRefExport { name, reason } in failed_branches { write!(formatter, " ")?; diff --git a/cli/src/merge_tools/external.rs b/cli/src/merge_tools/external.rs index 5b50578af..1aac8f5f5 100644 --- a/cli/src/merge_tools/external.rs +++ b/cli/src/merge_tools/external.rs @@ -325,7 +325,7 @@ pub fn generate_diff( tracing::info!(?cmd, ?exit_status, "The external diff generator exited:"); if !exit_status.success() { writeln!( - ui.warning_no_heading(), + ui.warning_default(), "{}", format_tool_aborted(&exit_status) ) diff --git a/cli/src/merge_tools/mod.rs b/cli/src/merge_tools/mod.rs index 505d04b88..19baec5f4 100644 --- a/cli/src/merge_tools/mod.rs +++ b/cli/src/merge_tools/mod.rs @@ -124,7 +124,7 @@ fn editor_args_from_settings( } else { let default_editor = BUILTIN_EDITOR_NAME; writeln!( - ui.hint_no_heading(), + ui.hint_default(), "Using default editor '{default_editor}'; run `jj config set --user {key} :builtin` \ to disable this message." ) diff --git a/cli/src/revset_util.rs b/cli/src/revset_util.rs index 24c9e311f..49ffbba09 100644 --- a/cli/src/revset_util.rs +++ b/cli/src/revset_util.rs @@ -63,7 +63,7 @@ pub fn load_revset_aliases( .and_then(|v| aliases_map.insert(&decl, v).map_err(|e| e.to_string())); if let Err(s) = r { writeln!( - ui.warning_no_heading(), + ui.warning_default(), r#"Failed to load "{TABLE_KEY}.{decl}": {s}"# )?; } diff --git a/cli/src/ui.rs b/cli/src/ui.rs index bcda33013..c4b747ac7 100644 --- a/cli/src/ui.rs +++ b/cli/src/ui.rs @@ -292,7 +292,7 @@ impl Ui { Err(e) => { // The pager executable couldn't be found or couldn't be run writeln!( - self.warning_no_heading(), + self.warning_default(), "Failed to spawn pager '{name}': {e}. Consider using the `:builtin` \ pager.", name = self.pager_cmd.split_name(), diff --git a/cli/tests/test_alias.rs b/cli/tests/test_alias.rs index 712e25f91..d54b19819 100644 --- a/cli/tests/test_alias.rs +++ b/cli/tests/test_alias.rs @@ -303,7 +303,7 @@ fn test_alias_in_repo_config() { user alias "###); insta::assert_snapshot!(stderr, @r###" - Command aliases cannot be loaded from -R/--repository path + Warning: Command aliases cannot be loaded from -R/--repository path "###); // Aliases are loaded from the cwd-relative workspace even with -R. @@ -313,7 +313,7 @@ fn test_alias_in_repo_config() { repo1 alias "###); insta::assert_snapshot!(stderr, @r###" - Command aliases cannot be loaded from -R/--repository path + Warning: Command aliases cannot be loaded from -R/--repository path "###); // No warning if the expanded command is identical. diff --git a/cli/tests/test_branch_command.rs b/cli/tests/test_branch_command.rs index 9d3076870..b31f39037 100644 --- a/cli/tests/test_branch_command.rs +++ b/cli/tests/test_branch_command.rs @@ -71,7 +71,7 @@ fn test_branch_at_root() { insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stderr, @r###" Nothing changed. - Failed to export some branches: + Warning: Failed to export some branches: fred: Ref cannot point to the root commit in Git "###); } @@ -251,7 +251,7 @@ fn test_branch_forget_glob() { test_env.jj_cmd_ok(&repo_path, &["branch", "forget", "--glob", "foo-[1-3]"]); insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stderr, @r###" - --glob has been deprecated. Please prefix the pattern with `glob:` instead. + Warning: --glob has been deprecated. Please prefix the pattern with `glob:` instead. Forgot 2 branches. "###); test_env.jj_cmd_ok(&repo_path, &["undo"]); @@ -273,7 +273,7 @@ fn test_branch_forget_glob() { ); insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stderr, @r###" - --glob has been deprecated. Please prefix the pattern with `glob:` instead. + Warning: --glob has been deprecated. Please prefix the pattern with `glob:` instead. "###); insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###" @ bar-2 230dd059e1b0 @@ -294,7 +294,7 @@ fn test_branch_forget_glob() { &["branch", "forget", "glob:bar*", "glob:baz*", "--glob=boom*"], ); insta::assert_snapshot!(stderr, @r###" - --glob has been deprecated. Please prefix the pattern with `glob:` instead. + Warning: --glob has been deprecated. Please prefix the pattern with `glob:` instead. Error: No matching branches for patterns: baz*, boom* "###); } @@ -333,7 +333,7 @@ fn test_branch_delete_glob() { test_env.jj_cmd_ok(&repo_path, &["branch", "delete", "--glob", "foo-[1-3]"]); insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stderr, @r###" - --glob has been deprecated. Please prefix the pattern with `glob:` instead. + Warning: --glob has been deprecated. Please prefix the pattern with `glob:` instead. Deleted 2 branches. "###); test_env.jj_cmd_ok(&repo_path, &["undo"]); @@ -351,7 +351,7 @@ fn test_branch_delete_glob() { // forget`, it's not allowed to delete already deleted branches. let stderr = test_env.jj_cmd_failure(&repo_path, &["branch", "delete", "--glob=foo-[1-3]"]); insta::assert_snapshot!(stderr, @r###" - --glob has been deprecated. Please prefix the pattern with `glob:` instead. + Warning: --glob has been deprecated. Please prefix the pattern with `glob:` instead. Error: No matching branches for patterns: foo-[1-3] "###); @@ -363,7 +363,7 @@ fn test_branch_delete_glob() { ); insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stderr, @r###" - --glob has been deprecated. Please prefix the pattern with `glob:` instead. + Warning: --glob has been deprecated. Please prefix the pattern with `glob:` instead. "###); insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###" @ bar-2 foo-1@origin foo-3@origin foo-4@origin 6fbf398c2d59 @@ -907,14 +907,14 @@ fn test_branch_track_untrack_patterns() { test_env.jj_cmd_ok(&repo_path, &["branch", "track", "feature1@origin"]); let (_, stderr) = test_env.jj_cmd_ok(&repo_path, &["branch", "track", "feature1@origin"]); insta::assert_snapshot!(stderr, @r###" - Remote branch already tracked: feature1@origin + Warning: Remote branch already tracked: feature1@origin Nothing changed. "###); // Untrack non-tracking branch let (_, stderr) = test_env.jj_cmd_ok(&repo_path, &["branch", "untrack", "feature2@origin"]); insta::assert_snapshot!(stderr, @r###" - Remote branch not tracked yet: feature2@origin + Warning: Remote branch not tracked yet: feature2@origin Nothing changed. "###); @@ -922,7 +922,7 @@ fn test_branch_track_untrack_patterns() { test_env.jj_cmd_ok(&repo_path, &["git", "export"]); let (_, stderr) = test_env.jj_cmd_ok(&repo_path, &["branch", "untrack", "main@git"]); insta::assert_snapshot!(stderr, @r###" - Git-tracking branch cannot be untracked: main@git + Warning: Git-tracking branch cannot be untracked: main@git Nothing changed. "###); insta::assert_snapshot!(get_branch_output(&test_env, &repo_path), @r###" @@ -937,9 +937,9 @@ fn test_branch_track_untrack_patterns() { // Untrack by pattern let (_, stderr) = test_env.jj_cmd_ok(&repo_path, &["branch", "untrack", "glob:*@*"]); insta::assert_snapshot!(stderr, @r###" - Git-tracking branch cannot be untracked: feature1@git - Remote branch not tracked yet: feature2@origin - Git-tracking branch cannot be untracked: main@git + Warning: Git-tracking branch cannot be untracked: feature1@git + Warning: Remote branch not tracked yet: feature2@origin + Warning: Git-tracking branch cannot be untracked: main@git "###); insta::assert_snapshot!(get_branch_output(&test_env, &repo_path), @r###" feature1: omvolwpu 1336caed commit diff --git a/cli/tests/test_commit_command.rs b/cli/tests/test_commit_command.rs index 686752de4..b315ab9f8 100644 --- a/cli/tests/test_commit_command.rs +++ b/cli/tests/test_commit_command.rs @@ -202,7 +202,7 @@ fn test_commit_paths_warning() { let (stdout, stderr) = test_env.jj_cmd_ok(&workspace_path, &["commit", "-m=first", "file3"]); insta::assert_snapshot!(stderr, @r###" - The given paths do not match any file: file3 + Warning: The given paths do not match any file: file3 Working copy now at: rlvkpnrz 67872820 (no description set) Parent commit : qpvuntsm 69542c19 (empty) first "###); diff --git a/cli/tests/test_config_command.rs b/cli/tests/test_config_command.rs index 8b1842ea5..c734be09c 100644 --- a/cli/tests/test_config_command.rs +++ b/cli/tests/test_config_command.rs @@ -54,7 +54,7 @@ fn test_config_list_nonexistent() { ); insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stderr, @r###" - No matching config key for nonexistent-test-key + Warning: No matching config key for nonexistent-test-key "###); } diff --git a/cli/tests/test_diff_command.rs b/cli/tests/test_diff_command.rs index 90014dc07..dac18276a 100644 --- a/cli/tests/test_diff_command.rs +++ b/cli/tests/test_diff_command.rs @@ -854,7 +854,7 @@ fn test_diff_external_tool() { diff "###); insta::assert_snapshot!(stderr, @r###" - Tool exited with a non-zero code (run with --debug to see the exact invocation). Exit code: 1. + Warning: Tool exited with a non-zero code (run with --debug to see the exact invocation). Exit code: 1. "###); // --tool=:builtin shouldn't be ignored diff --git a/cli/tests/test_git_colocated.rs b/cli/tests/test_git_colocated.rs index b518ea749..b940fce3f 100644 --- a/cli/tests/test_git_colocated.rs +++ b/cli/tests/test_git_colocated.rs @@ -402,7 +402,7 @@ fn test_git_colocated_conflicting_git_refs() { insta::assert_snapshot!(stdout, @""); insta::with_settings!({filters => vec![(": The lock for resource.*", ": ...")]}, { insta::assert_snapshot!(stderr, @r###" - Failed to export some branches: + Warning: Failed to export some branches: main/sub: Failed to set: A lock could not be obtained for reference "refs/heads/main/sub": ... Hint: Git doesn't allow a branch name that looks like a parent directory of another (e.g. `foo` and `foo/bar`). Try to rename the branches that failed to @@ -555,7 +555,7 @@ fn test_git_colocated_rebase_dirty_working_copy() { Use `jj branch list` to see details. Use `jj branch set -r ` to resolve. "###); insta::assert_snapshot!(stderr, @r###" - Failed to export some branches: + Warning: Failed to export some branches: feature: Modified ref had been deleted in Git Done importing changes from the underlying Git repo. "###); diff --git a/cli/tests/test_git_fetch.rs b/cli/tests/test_git_fetch.rs index d16a0c060..0ec1b3f58 100644 --- a/cli/tests/test_git_fetch.rs +++ b/cli/tests/test_git_fetch.rs @@ -109,7 +109,7 @@ fn test_git_fetch_single_remote() { let (_stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["git", "fetch"]); insta::assert_snapshot!(stderr, @r###" - Fetching from the only existing remote: rem1 + Hint: Fetching from the only existing remote: rem1 branch: rem1@rem1 [new] tracked "###); insta::assert_snapshot!(get_branch_output(&test_env, &repo_path), @r###" diff --git a/cli/tests/test_git_import_export.rs b/cli/tests/test_git_import_export.rs index 1193fb5a1..7e6b0be64 100644 --- a/cli/tests/test_git_import_export.rs +++ b/cli/tests/test_git_import_export.rs @@ -67,7 +67,7 @@ fn test_git_export_conflicting_git_refs() { insta::assert_snapshot!(stdout, @""); insta::with_settings!({filters => vec![(": The lock for resource.*", ": ...")]}, { insta::assert_snapshot!(stderr, @r###" - Failed to export some branches: + Warning: Failed to export some branches: main/sub: Failed to set: A lock could not be obtained for reference "refs/heads/main/sub": ... Hint: Git doesn't allow a branch name that looks like a parent directory of another (e.g. `foo` and `foo/bar`). Try to rename the branches that failed to diff --git a/cli/tests/test_git_init.rs b/cli/tests/test_git_init.rs index 927901189..9223c6f6e 100644 --- a/cli/tests/test_git_init.rs +++ b/cli/tests/test_git_init.rs @@ -429,7 +429,7 @@ fn test_git_init_colocated_via_git_repo_path_imported_refs() { let (_stdout, stderr) = test_env.jj_cmd_ok(&local_path, &["git", "init", "--git-repo=."]); insta::assert_snapshot!(stderr, @r###" Done importing changes from the underlying Git repo. - The following remote branches aren't associated with the existing local branches: + Hint: The following remote branches aren't associated with the existing local branches: local-remote@origin Hint: Run `jj branch track local-remote@origin` to keep local branches updated on future pulls. Initialized repo in "." diff --git a/cli/tests/test_git_push.rs b/cli/tests/test_git_push.rs index 2dd0747ec..74419db64 100644 --- a/cli/tests/test_git_push.rs +++ b/cli/tests/test_git_push.rs @@ -141,7 +141,7 @@ fn test_git_push_no_matching_branch() { let (stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push"]); insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stderr, @r###" - No branches found in the default push revset: remote_branches(remote=origin)..@ + Warning: No branches found in the default push revset: remote_branches(remote=origin)..@ Nothing changed. "###); } @@ -153,7 +153,7 @@ fn test_git_push_matching_branch_unchanged() { let (stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push"]); insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stderr, @r###" - No branches found in the default push revset: remote_branches(remote=origin)..@ + Warning: No branches found in the default push revset: remote_branches(remote=origin)..@ Nothing changed. "###); } @@ -196,7 +196,7 @@ fn test_git_push_other_remote_has_branch() { let (stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push"]); insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stderr, @r###" - No branches found in the default push revset: remote_branches(remote=origin)..@ + Warning: No branches found in the default push revset: remote_branches(remote=origin)..@ Nothing changed. "###); // But it will still get pushed to another remote @@ -505,14 +505,14 @@ fn test_git_push_revisions() { // Push an empty set let (_stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push", "-r=none()"]); insta::assert_snapshot!(stderr, @r###" - No branches point to the specified revisions: none() + Warning: No branches point to the specified revisions: none() Nothing changed. "###); // Push a revision with no branches let (stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push", "-r=@--"]); insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stderr, @r###" - No branches point to the specified revisions: @-- + Warning: No branches point to the specified revisions: @-- Nothing changed. "###); // Push a revision with a single branch @@ -531,7 +531,7 @@ fn test_git_push_revisions() { ); insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stderr, @r###" - No branches point to the specified revisions: @-- + Warning: No branches point to the specified revisions: @-- Branch changes to push to origin: Add branch branch-1 to 7decc7932d9c Dry-run requested, not pushing. @@ -775,7 +775,7 @@ fn test_git_push_conflicting_branches() { let (stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push"]); insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stderr, @r###" - Branch branch2 is conflicted + Warning: Branch branch2 is conflicted Hint: Run `jj branch list` to inspect, and use `jj branch set` to fix it up. Nothing changed. "###); @@ -792,7 +792,7 @@ fn test_git_push_conflicting_branches() { let (stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push", "--all"]); insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stderr, @r###" - Branch branch2 is conflicted + Warning: Branch branch2 is conflicted Hint: Run `jj branch list` to inspect, and use `jj branch set` to fix it up. Branch changes to push to origin: Move branch branch1 from 45a3aa29e907 to fd1d63e031ea @@ -803,7 +803,7 @@ fn test_git_push_conflicting_branches() { let (stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push", "-rall()"]); insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stderr, @r###" - Branch branch2 is conflicted + Warning: Branch branch2 is conflicted Hint: Run `jj branch list` to inspect, and use `jj branch set` to fix it up. Branch changes to push to origin: Move branch branch1 from fd1d63e031ea to 8263cf992d33 @@ -891,7 +891,7 @@ fn test_git_push_tracked_vs_all() { // instead of showing an error here. let (_stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push", "--all"]); insta::assert_snapshot!(stderr, @r###" - Non-tracking remote branch branch1@origin exists + Warning: Non-tracking remote branch branch1@origin exists Hint: Run `jj branch track branch1@origin` to import the remote branch. Branch changes to push to origin: Add branch branch3 to 998d6a7853d9 @@ -907,7 +907,7 @@ fn test_git_push_moved_forward_untracked() { test_env.jj_cmd_ok(&workspace_root, &["branch", "untrack", "branch1@origin"]); let (_stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push"]); insta::assert_snapshot!(stderr, @r###" - Non-tracking remote branch branch1@origin exists + Warning: Non-tracking remote branch branch1@origin exists Hint: Run `jj branch track branch1@origin` to import the remote branch. Nothing changed. "###); @@ -925,7 +925,7 @@ fn test_git_push_moved_sideways_untracked() { test_env.jj_cmd_ok(&workspace_root, &["branch", "untrack", "branch1@origin"]); let (_stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push"]); insta::assert_snapshot!(stderr, @r###" - Non-tracking remote branch branch1@origin exists + Warning: Non-tracking remote branch branch1@origin exists Hint: Run `jj branch track branch1@origin` to import the remote branch. Nothing changed. "###); diff --git a/cli/tests/test_gitignores.rs b/cli/tests/test_gitignores.rs index 486a8e688..749095163 100644 --- a/cli/tests/test_gitignores.rs +++ b/cli/tests/test_gitignores.rs @@ -91,7 +91,7 @@ fn test_gitignores_ignored_file_in_target_commit() { Working copy now at: qpvuntsm 4a703628 with-file | (no description set) Parent commit : zzzzzzzz 00000000 (empty) (no description set) Added 1 files, modified 0 files, removed 0 files - 1 of those updates were skipped because there were conflicting changes in the working copy. + Warning: 1 of those updates were skipped because there were conflicting changes in the working copy. Hint: Inspect the changes compared to the intended target with `jj diff --from 4a703628bcb2`. Discard the conflicting changes with `jj restore --from 4a703628bcb2`. "###); diff --git a/cli/tests/test_global_opts.rs b/cli/tests/test_global_opts.rs index c4fd6f577..12285bd35 100644 --- a/cli/tests/test_global_opts.rs +++ b/cli/tests/test_global_opts.rs @@ -475,7 +475,7 @@ fn test_no_user_configured() { insta::assert_snapshot!(get_stderr_string(&assert), @r###" Working copy now at: qpvuntsm 7a7d6016 (empty) without name Parent commit : zzzzzzzz 00000000 (empty) (no description set) - Name and email not configured. Until configured, your commits will be created with the empty identity, and can't be pushed to remotes. To configure, run: + Warning: Name and email not configured. Until configured, your commits will be created with the empty identity, and can't be pushed to remotes. To configure, run: jj config set --user user.name "Some One" jj config set --user user.email "someone@example.com" "###); @@ -487,7 +487,7 @@ fn test_no_user_configured() { insta::assert_snapshot!(get_stderr_string(&assert), @r###" Working copy now at: qpvuntsm 906f8b89 (empty) without email Parent commit : zzzzzzzz 00000000 (empty) (no description set) - Name and email not configured. Until configured, your commits will be created with the empty identity, and can't be pushed to remotes. To configure, run: + Warning: Name and email not configured. Until configured, your commits will be created with the empty identity, and can't be pushed to remotes. To configure, run: jj config set --user user.name "Some One" jj config set --user user.email "someone@example.com" "###); diff --git a/cli/tests/test_init_command.rs b/cli/tests/test_init_command.rs index 9f412bfa3..403c4d14f 100644 --- a/cli/tests/test_init_command.rs +++ b/cli/tests/test_init_command.rs @@ -441,7 +441,7 @@ fn test_init_git_colocated_imported_refs() { let (_stdout, stderr) = test_env.jj_cmd_ok(&local_path, &["init", "--git-repo=."]); insta::assert_snapshot!(stderr, @r###" Done importing changes from the underlying Git repo. - The following remote branches aren't associated with the existing local branches: + Hint: The following remote branches aren't associated with the existing local branches: local-remote@origin Hint: Run `jj branch track local-remote@origin` to keep local branches updated on future pulls. Warning: `--git` and `--git-repo` are deprecated. diff --git a/cli/tests/test_operations.rs b/cli/tests/test_operations.rs index 1e8570565..4e05eb55a 100644 --- a/cli/tests/test_operations.rs +++ b/cli/tests/test_operations.rs @@ -489,7 +489,7 @@ fn test_op_abandon_without_updating_working_copy() { let (_stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["op", "abandon", "@-"]); insta::assert_snapshot!(stderr, @r###" Abandoned 1 operations and reparented 1 descendant operations. - The working copy operation 61aeade2493b is not updated because it differs from the repo ae6364994418. + Warning: The working copy operation 61aeade2493b is not updated because it differs from the repo ae6364994418. "###); insta::assert_snapshot!( test_env.jj_cmd_success(&repo_path, &["debug", "workingcopy", "--ignore-working-copy"]), @r###" diff --git a/cli/tests/test_resolve_command.rs b/cli/tests/test_resolve_command.rs index f25d6f14a..057b76164 100644 --- a/cli/tests/test_resolve_command.rs +++ b/cli/tests/test_resolve_command.rs @@ -447,7 +447,7 @@ fn test_too_many_parents() { let error = test_env.jj_cmd_failure(&repo_path, &["resolve"]); insta::assert_snapshot!(error, @r###" - Using default editor ':builtin'; run `jj config set --user ui.merge-editor :builtin` to disable this message. + Hint: Using default editor ':builtin'; run `jj config set --user ui.merge-editor :builtin` to disable this message. Resolving conflicts in: file Error: Failed to resolve conflicts Caused by: The conflict at "file" has 3 sides. At most 2 sides are supported. @@ -525,7 +525,7 @@ fn test_file_vs_dir() { "###); let error = test_env.jj_cmd_failure(&repo_path, &["resolve"]); insta::assert_snapshot!(error, @r###" - Using default editor ':builtin'; run `jj config set --user ui.merge-editor :builtin` to disable this message. + Hint: Using default editor ':builtin'; run `jj config set --user ui.merge-editor :builtin` to disable this message. Resolving conflicts in: file Error: Failed to resolve conflicts Caused by: Only conflicts that involve normal files (not symlinks, not executable, etc.) are supported. Conflict summary for "file": @@ -582,7 +582,7 @@ fn test_description_with_dir_and_deletion() { "###); let error = test_env.jj_cmd_failure(&repo_path, &["resolve"]); insta::assert_snapshot!(error, @r###" - Using default editor ':builtin'; run `jj config set --user ui.merge-editor :builtin` to disable this message. + Hint: Using default editor ':builtin'; run `jj config set --user ui.merge-editor :builtin` to disable this message. Resolving conflicts in: file Error: Failed to resolve conflicts Caused by: Only conflicts that involve normal files (not symlinks, not executable, etc.) are supported. Conflict summary for "file": diff --git a/cli/tests/test_revset_output.rs b/cli/tests/test_revset_output.rs index 8038e4a47..6aba204a7 100644 --- a/cli/tests/test_revset_output.rs +++ b/cli/tests/test_revset_output.rs @@ -422,13 +422,13 @@ fn test_bad_alias_decl() { ◉ zzzzzzzz root() 00000000 "###); insta::assert_snapshot!(stderr, @r###" - Failed to load "revset-aliases."bad"": --> 1:1 + Warning: Failed to load "revset-aliases."bad"": --> 1:1 | 1 | "bad" | ^--- | = expected or - Failed to load "revset-aliases.badfn(a, a)": --> 1:7 + Warning: Failed to load "revset-aliases.badfn(a, a)": --> 1:7 | 1 | badfn(a, a) | ^--^ diff --git a/cli/tests/test_split_command.rs b/cli/tests/test_split_command.rs index 65b0c64e2..03799c426 100644 --- a/cli/tests/test_split_command.rs +++ b/cli/tests/test_split_command.rs @@ -119,7 +119,7 @@ fn test_split_by_paths() { let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["split", "-r", "@-", "nonexistent"]); insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stderr, @r###" - The given paths do not match any file: nonexistent + Warning: The given paths do not match any file: nonexistent Rebased 1 descendant commits First part: qpvuntsm 7086b0bc (empty) (no description set) Second part: lylxulpl 2252ed18 (no description set) diff --git a/cli/tests/test_templater.rs b/cli/tests/test_templater.rs index 7072bc1bb..da8c4d982 100644 --- a/cli/tests/test_templater.rs +++ b/cli/tests/test_templater.rs @@ -306,7 +306,7 @@ fn test_templater_bad_alias_decl() { test_env.jj_cmd_ok(&repo_path, &["log", "--no-graph", "-r@-", "-Tmy_commit_id"]); insta::assert_snapshot!(stdout, @"000000000000"); insta::assert_snapshot!(stderr, @r###" - Failed to load "template-aliases.badfn(a, a)": --> 1:7 + Warning: Failed to load "template-aliases.badfn(a, a)": --> 1:7 | 1 | badfn(a, a) | ^--^