diff --git a/CHANGELOG.md b/CHANGELOG.md index c141d4ab30..47b8bebf5c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -53,6 +53,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * `jj git fetch` now automatically prints new remote branches and tags by default. +* `--verbose/-v` is now `--debug` (no short option since it's not intended to be used often) + ### Fixed bugs * On Windows, symlinks in the repo are now materialized as regular files in the diff --git a/cli/src/cli_util.rs b/cli/src/cli_util.rs index 82fa387531..3348f8ce61 100644 --- a/cli/src/cli_util.rs +++ b/cli/src/cli_util.rs @@ -555,15 +555,15 @@ impl TracingSubscription { } } - pub fn enable_verbose_logging(&self) -> Result<(), CommandError> { + pub fn enable_debug_logging(&self) -> Result<(), CommandError> { self.reload_log_filter .modify(|filter| { *filter = tracing_subscriber::EnvFilter::builder() .with_default_directive(tracing::metadata::LevelFilter::DEBUG.into()) .from_env_lossy() }) - .map_err(|err| internal_error_with_message("failed to enable verbose logging", err))?; - tracing::info!("verbose logging enabled"); + .map_err(|err| internal_error_with_message("failed to enable debug logging", err))?; + tracing::info!("debug logging enabled"); Ok(()) } } @@ -2497,9 +2497,9 @@ pub struct GlobalArgs { /// do that, but it is possible. #[arg(long, visible_alias = "at-op", global = true, default_value = "@")] pub at_operation: String, - /// Enable verbose logging - #[arg(long, short = 'v', global = true)] - pub verbose: bool, + /// Enable debug logging + #[arg(long, global = true)] + pub debug: bool, #[command(flatten)] pub early_args: EarlyArgs, @@ -2743,9 +2743,9 @@ pub fn parse_args( .try_get_matches_from(string_args)?; let args: Args = Args::from_arg_matches(&matches).unwrap(); - if args.global_args.verbose { - // TODO: set up verbose logging as early as possible - tracing_subscription.enable_verbose_logging()?; + if args.global_args.debug { + // TODO: set up debug logging as early as possible + tracing_subscription.enable_debug_logging()?; } Ok((matches, args)) diff --git a/cli/src/merge_tools/external.rs b/cli/src/merge_tools/external.rs index 31f71c8335..af588a1da6 100644 --- a/cli/src/merge_tools/external.rs +++ b/cli/src/merge_tools/external.rs @@ -116,9 +116,9 @@ pub enum ExternalToolError { MergeArgsNotConfigured { tool_name: String }, #[error("Error setting up temporary directory")] SetUpDir(#[source] std::io::Error), - // TODO: Remove the "(run with --verbose to see the exact invocation)" - // from this and other errors. Print it as a hint but only if --verbose is *not* set. - #[error("Error executing '{tool_binary}' (run with --verbose to see the exact invocation)")] + // TODO: Remove the "(run with --debug to see the exact invocation)" + // from this and other errors. Print it as a hint but only if --debug is *not* set. + #[error("Error executing '{tool_binary}' (run with --debug to see the exact invocation)")] FailedToExecute { tool_binary: String, #[source] @@ -575,7 +575,7 @@ fn format_tool_aborted(exit_status: &ExitStatus) -> String { .map(|c| c.to_string()) .unwrap_or_else(|| "".to_string()); format!( - "Tool exited with a non-zero code (run with --verbose to see the exact invocation). Exit \ + "Tool exited with a non-zero code (run with --debug to see the exact invocation). Exit \ code: {code}." ) } diff --git a/cli/src/merge_tools/mod.rs b/cli/src/merge_tools/mod.rs index 4f4ae0eaf4..a7681c9477 100644 --- a/cli/src/merge_tools/mod.rs +++ b/cli/src/merge_tools/mod.rs @@ -77,8 +77,8 @@ pub enum ConflictResolveError { #[error("The conflict at {path:?} has {sides} sides. At most 2 sides are supported.")] ConflictTooComplicated { path: RepoPathBuf, sides: usize }, #[error( - "The output file is either unchanged or empty after the editor quit (run with --verbose \ - to see the exact invocation)." + "The output file is either unchanged or empty after the editor quit (run with --debug to \ + see the exact invocation)." )] EmptyOrUnchanged, #[error("Backend error")] diff --git a/cli/tests/cli-reference@.md.snap b/cli/tests/cli-reference@.md.snap index 8e11a0256f..5a4274d170 100644 --- a/cli/tests/cli-reference@.md.snap +++ b/cli/tests/cli-reference@.md.snap @@ -154,7 +154,7 @@ repository. * `--at-operation ` — Operation to load the repo at Default value: `@` -* `-v`, `--verbose` — Enable verbose logging +* `--debug` — Enable debug logging Possible values: `true`, `false` diff --git a/cli/tests/test_diff_command.rs b/cli/tests/test_diff_command.rs index 93063b0b06..e73ceccf4a 100644 --- a/cli/tests/test_diff_command.rs +++ b/cli/tests/test_diff_command.rs @@ -751,7 +751,7 @@ fn test_diff_external_tool() { diff "###); insta::assert_snapshot!(stderr, @r###" - Tool exited with a non-zero code (run with --verbose to see the exact invocation). Exit code: 1. + Tool exited with a non-zero code (run with --debug to see the exact invocation). Exit code: 1. "###); } diff --git a/cli/tests/test_diffedit_command.rs b/cli/tests/test_diffedit_command.rs index 3c7b93790a..383f7a82f9 100644 --- a/cli/tests/test_diffedit_command.rs +++ b/cli/tests/test_diffedit_command.rs @@ -51,7 +51,7 @@ fn test_diffedit() { std::fs::write(&edit_script, "rm file2\0fail").unwrap(); insta::assert_snapshot!(&test_env.jj_cmd_failure(&repo_path, &["diffedit"]), @r###" Error: Failed to edit diff - Caused by: Tool exited with a non-zero code (run with --verbose to see the exact invocation). Exit code: 1. + Caused by: Tool exited with a non-zero code (run with --debug to see the exact invocation). Exit code: 1. "###); let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-s"]); insta::assert_snapshot!(stdout, @r###" @@ -395,7 +395,7 @@ fn test_diffedit_old_restore_interactive_tests() { std::fs::write(&edit_script, "rm file2\0fail").unwrap(); insta::assert_snapshot!(&test_env.jj_cmd_failure(&repo_path, &["diffedit", "--from", "@-"]), @r###" Error: Failed to edit diff - Caused by: Tool exited with a non-zero code (run with --verbose to see the exact invocation). Exit code: 1. + Caused by: Tool exited with a non-zero code (run with --debug to see the exact invocation). Exit code: 1. "###); let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-s"]); insta::assert_snapshot!(stdout, @r###" diff --git a/cli/tests/test_global_opts.rs b/cli/tests/test_global_opts.rs index 4d7e10fac8..f6bafbc4df 100644 --- a/cli/tests/test_global_opts.rs +++ b/cli/tests/test_global_opts.rs @@ -446,7 +446,7 @@ fn test_help() { -R, --repository Path to repository to operate on --ignore-working-copy Don't snapshot the working copy, and don't update it --at-operation Operation to load the repo at [default: @] [aliases: at-op] - -v, --verbose Enable verbose logging + --debug Enable debug logging --color When to colorize output (always, never, auto) --no-pager Disable the pager --config-toml Additional configuration options (can be repeated) @@ -454,22 +454,22 @@ fn test_help() { } #[test] -fn test_verbose_logging_enabled() { - // Test that the verbose flag enabled verbose logging +fn test_debug_logging_enabled() { + // Test that the debug flag enabled debug logging let test_env = TestEnvironment::default(); - let (_stdout, stderr) = test_env.jj_cmd_ok(test_env.env_root(), &["version", "-v"]); + let (_stdout, stderr) = test_env.jj_cmd_ok(test_env.env_root(), &["version", "--debug"]); // Split the first log line into a timestamp and the rest. // The timestamp is constant sized so this is a robust operation. // Example timestamp: 2022-11-20T06:24:05.477703Z let (_timestamp, log_line) = stderr .lines() .next() - .expect("verbose logging on first line") + .expect("debug logging on first line") .split_at(36); // The log format is currently Pretty so we include the terminal markup. // Luckily, insta will print this in colour when reviewing. - insta::assert_snapshot!(log_line, @" INFO jj_cli::cli_util: verbose logging enabled"); + insta::assert_snapshot!(log_line, @" INFO jj_cli::cli_util: debug logging enabled"); } fn strip_last_line(s: &str) -> &str { diff --git a/cli/tests/test_resolve_command.rs b/cli/tests/test_resolve_command.rs index a95656cd7f..e90613c8e2 100644 --- a/cli/tests/test_resolve_command.rs +++ b/cli/tests/test_resolve_command.rs @@ -299,7 +299,7 @@ fn check_resolve_produces_input_file( assert_eq!( &test_env.jj_cmd_failure(repo_path, &["resolve", "--config-toml", &merge_arg_config]), "Resolving conflicts in: file\nError: Failed to resolve conflicts\nCaused by: The output \ - file is either unchanged or empty after the editor quit (run with --verbose to see the \ + file is either unchanged or empty after the editor quit (run with --debug to see the \ exact invocation).\n" ); }