From 646fc338abfd1ffe4d216e3c7a76a661db6ca402 Mon Sep 17 00:00:00 2001 From: Benjamin Saunders Date: Tue, 18 Oct 2022 22:21:25 -0700 Subject: [PATCH] Include @ in the default revset Yields a less confusing behavior of `jj log` after pushing a commit. --- lib/src/settings.rs | 2 +- src/commands.rs | 2 +- tests/test_alias.rs | 4 ++-- tests/test_operations.rs | 5 ++++- tests/test_workspaces.rs | 11 ++++++++++- 5 files changed, 18 insertions(+), 6 deletions(-) diff --git a/lib/src/settings.rs b/lib/src/settings.rs index 4a5dcf957..ccd58480e 100644 --- a/lib/src/settings.rs +++ b/lib/src/settings.rs @@ -82,7 +82,7 @@ impl UserSettings { pub fn default_revset(&self) -> String { self.config .get_string("ui.default-revset") - .unwrap_or_else(|_| "remote_branches().. | (remote_branches()..)-".to_string()) + .unwrap_or_else(|_| "@ | remote_branches().. | (remote_branches()..)-".to_string()) } pub fn signature(&self) -> Signature { diff --git a/src/commands.rs b/src/commands.rs index 141290ce2..804f7efa7 100644 --- a/src/commands.rs +++ b/src/commands.rs @@ -259,7 +259,7 @@ struct StatusArgs {} #[derive(clap::Args, Clone, Debug)] struct LogArgs { /// Which revisions to show. Defaults to the `ui.default-revset` setting, - /// or "remote_branches().. | (remote_branches()..)-" if it is not set. + /// or "@ | remote_branches().. | (remote_branches()..)-" if it is not set. #[arg(long, short)] revisions: Option, /// Show commits modifying the given paths diff --git a/tests/test_alias.rs b/tests/test_alias.rs index fe5c92129..bb210c1f8 100644 --- a/tests/test_alias.rs +++ b/tests/test_alias.rs @@ -101,7 +101,7 @@ fn test_alias_global_args_before_and_after() { let repo_path = test_env.env_root().join("repo"); test_env.add_config( br#"[alias] - l = ["log", "-T", "commit_id"] + l = ["log", "-T", "commit_id", "-r", "all()"] "#, ); // Test the setup @@ -140,7 +140,7 @@ fn test_alias_global_args_in_definition() { let repo_path = test_env.env_root().join("repo"); test_env.add_config( br#"[alias] - l = ["log", "-T", "commit_id", "--at-op", "@-"] + l = ["log", "-T", "commit_id", "--at-op", "@-", "-r", "all()"] "#, ); diff --git a/tests/test_operations.rs b/tests/test_operations.rs index 82254c595..efa45200c 100644 --- a/tests/test_operations.rs +++ b/tests/test_operations.rs @@ -90,7 +90,10 @@ fn test_op_log() { } fn get_log_output(test_env: &TestEnvironment, repo_path: &Path, op_id: &str) -> String { - test_env.jj_cmd_success(repo_path, &["log", "-T", "commit_id", "--at-op", op_id]) + test_env.jj_cmd_success( + repo_path, + &["log", "-T", "commit_id", "--at-op", op_id, "-r", "all()"], + ) } fn redact_op_log(stdout: &str) -> String { diff --git a/tests/test_workspaces.rs b/tests/test_workspaces.rs index 0102fc092..06aa70ce6 100644 --- a/tests/test_workspaces.rs +++ b/tests/test_workspaces.rs @@ -198,5 +198,14 @@ fn test_workspaces_forget() { } fn get_log_output(test_env: &TestEnvironment, cwd: &Path) -> String { - test_env.jj_cmd_success(cwd, &["log", "-T", r#"commit_id " " working_copies"#]) + test_env.jj_cmd_success( + cwd, + &[ + "log", + "-T", + r#"commit_id " " working_copies"#, + "-r", + "all()", + ], + ) }