2022-11-26 23:57:50 +00:00
|
|
|
|
// Copyright 2022 The Jujutsu Authors
|
2022-03-28 09:12:08 +00:00
|
|
|
|
//
|
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
|
// You may obtain a copy of the License at
|
|
|
|
|
//
|
|
|
|
|
// https://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
//
|
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
|
// limitations under the License.
|
|
|
|
|
|
2024-08-22 18:18:15 +00:00
|
|
|
|
use crate::common::get_stdout_string;
|
|
|
|
|
use crate::common::TestEnvironment;
|
2022-03-28 09:12:08 +00:00
|
|
|
|
|
2022-11-28 14:32:44 +00:00
|
|
|
|
#[test]
|
|
|
|
|
fn test_log_with_empty_revision() {
|
|
|
|
|
let test_env = TestEnvironment::default();
|
2024-05-17 19:49:25 +00:00
|
|
|
|
test_env.jj_cmd_ok(test_env.env_root(), &["git", "init", "repo"]);
|
2022-11-28 14:32:44 +00:00
|
|
|
|
let repo_path = test_env.env_root().join("repo");
|
|
|
|
|
|
|
|
|
|
let stderr = test_env.jj_cmd_cli_error(&repo_path, &["log", "-r="]);
|
|
|
|
|
insta::assert_snapshot!(stderr, @r###"
|
2023-03-17 23:14:20 +00:00
|
|
|
|
error: a value is required for '--revisions <REVISIONS>' but none was supplied
|
2022-11-28 14:32:44 +00:00
|
|
|
|
|
2023-03-17 23:14:20 +00:00
|
|
|
|
For more information, try '--help'.
|
2022-11-28 14:32:44 +00:00
|
|
|
|
"###);
|
|
|
|
|
}
|
|
|
|
|
|
2024-03-03 06:04:59 +00:00
|
|
|
|
#[test]
|
|
|
|
|
fn test_log_with_no_template() {
|
|
|
|
|
let test_env = TestEnvironment::default();
|
2024-05-17 19:49:25 +00:00
|
|
|
|
test_env.jj_cmd_ok(test_env.env_root(), &["git", "init", "repo"]);
|
2024-03-03 06:04:59 +00:00
|
|
|
|
let repo_path = test_env.env_root().join("repo");
|
|
|
|
|
|
|
|
|
|
let stderr = test_env.jj_cmd_cli_error(&repo_path, &["log", "-T"]);
|
2024-09-12 14:20:57 +00:00
|
|
|
|
insta::assert_snapshot!(stderr, @r#"
|
2024-03-03 06:04:59 +00:00
|
|
|
|
error: a value is required for '--template <TEMPLATE>' but none was supplied
|
|
|
|
|
|
|
|
|
|
For more information, try '--help'.
|
|
|
|
|
Hint: The following template aliases are defined:
|
|
|
|
|
- builtin_log_comfortable
|
|
|
|
|
- builtin_log_compact
|
|
|
|
|
- builtin_log_detailed
|
2024-04-13 19:12:16 +00:00
|
|
|
|
- builtin_log_node
|
|
|
|
|
- builtin_log_node_ascii
|
2024-03-03 06:04:59 +00:00
|
|
|
|
- builtin_log_oneline
|
|
|
|
|
- builtin_op_log_comfortable
|
|
|
|
|
- builtin_op_log_compact
|
2024-04-13 19:12:16 +00:00
|
|
|
|
- builtin_op_log_node
|
|
|
|
|
- builtin_op_log_node_ascii
|
2024-03-03 06:04:59 +00:00
|
|
|
|
- commit_summary_separator
|
|
|
|
|
- description_placeholder
|
|
|
|
|
- email_placeholder
|
|
|
|
|
- name_placeholder
|
2024-09-12 14:20:57 +00:00
|
|
|
|
"#);
|
2024-03-03 06:04:59 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-03-28 09:12:08 +00:00
|
|
|
|
#[test]
|
|
|
|
|
fn test_log_with_or_without_diff() {
|
|
|
|
|
let test_env = TestEnvironment::default();
|
2024-05-17 19:49:25 +00:00
|
|
|
|
test_env.jj_cmd_ok(test_env.env_root(), &["git", "init", "repo"]);
|
2022-03-28 09:12:08 +00:00
|
|
|
|
let repo_path = test_env.env_root().join("repo");
|
|
|
|
|
|
|
|
|
|
std::fs::write(repo_path.join("file1"), "foo\n").unwrap();
|
2023-10-10 11:59:18 +00:00
|
|
|
|
test_env.jj_cmd_ok(&repo_path, &["describe", "-m", "add a file"]);
|
|
|
|
|
test_env.jj_cmd_ok(&repo_path, &["new", "-m", "a new commit"]);
|
2022-03-28 09:12:08 +00:00
|
|
|
|
std::fs::write(repo_path.join("file1"), "foo\nbar\n").unwrap();
|
|
|
|
|
|
|
|
|
|
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-T", "description"]);
|
|
|
|
|
insta::assert_snapshot!(stdout, @r###"
|
2023-02-09 02:53:47 +00:00
|
|
|
|
@ a new commit
|
2024-07-15 22:20:10 +00:00
|
|
|
|
○ add a file
|
|
|
|
|
◆
|
2022-03-28 09:12:08 +00:00
|
|
|
|
"###);
|
|
|
|
|
|
|
|
|
|
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-T", "description", "-p"]);
|
|
|
|
|
insta::assert_snapshot!(stdout, @r###"
|
2023-02-09 02:53:47 +00:00
|
|
|
|
@ a new commit
|
|
|
|
|
│ Modified regular file file1:
|
|
|
|
|
│ 1 1: foo
|
|
|
|
|
│ 2: bar
|
2024-07-15 22:20:10 +00:00
|
|
|
|
○ add a file
|
2023-02-09 02:53:47 +00:00
|
|
|
|
│ Added regular file file1:
|
|
|
|
|
│ 1: foo
|
2024-07-15 22:20:10 +00:00
|
|
|
|
◆
|
2022-03-28 09:12:08 +00:00
|
|
|
|
"###);
|
|
|
|
|
|
|
|
|
|
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-T", "description", "--no-graph"]);
|
|
|
|
|
insta::assert_snapshot!(stdout, @r###"
|
|
|
|
|
a new commit
|
|
|
|
|
add a file
|
|
|
|
|
"###);
|
|
|
|
|
|
2022-12-13 12:24:24 +00:00
|
|
|
|
// `-p` for default diff output, `-s` for summary
|
|
|
|
|
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-T", "description", "-p", "-s"]);
|
|
|
|
|
insta::assert_snapshot!(stdout, @r###"
|
2023-02-09 02:53:47 +00:00
|
|
|
|
@ a new commit
|
|
|
|
|
│ M file1
|
|
|
|
|
│ Modified regular file file1:
|
|
|
|
|
│ 1 1: foo
|
|
|
|
|
│ 2: bar
|
2024-07-15 22:20:10 +00:00
|
|
|
|
○ add a file
|
2023-02-09 02:53:47 +00:00
|
|
|
|
│ A file1
|
|
|
|
|
│ Added regular file file1:
|
|
|
|
|
│ 1: foo
|
2024-07-15 22:20:10 +00:00
|
|
|
|
◆
|
2022-12-13 12:24:24 +00:00
|
|
|
|
"###);
|
|
|
|
|
|
|
|
|
|
// `-s` for summary, `--git` for git diff (which implies `-p`)
|
|
|
|
|
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-T", "description", "-s", "--git"]);
|
|
|
|
|
insta::assert_snapshot!(stdout, @r###"
|
2023-02-09 02:53:47 +00:00
|
|
|
|
@ a new commit
|
|
|
|
|
│ M file1
|
|
|
|
|
│ diff --git a/file1 b/file1
|
2024-07-14 10:26:07 +00:00
|
|
|
|
│ index 257cc5642c..3bd1f0e297 100644
|
2023-02-09 02:53:47 +00:00
|
|
|
|
│ --- a/file1
|
|
|
|
|
│ +++ b/file1
|
|
|
|
|
│ @@ -1,1 +1,2 @@
|
|
|
|
|
│ foo
|
|
|
|
|
│ +bar
|
2024-07-15 22:20:10 +00:00
|
|
|
|
○ add a file
|
2023-02-09 02:53:47 +00:00
|
|
|
|
│ A file1
|
|
|
|
|
│ diff --git a/file1 b/file1
|
|
|
|
|
│ new file mode 100644
|
|
|
|
|
│ index 0000000000..257cc5642c
|
|
|
|
|
│ --- /dev/null
|
|
|
|
|
│ +++ b/file1
|
|
|
|
|
│ @@ -1,0 +1,1 @@
|
|
|
|
|
│ +foo
|
2024-07-15 22:20:10 +00:00
|
|
|
|
◆
|
2022-12-13 12:24:24 +00:00
|
|
|
|
"###);
|
|
|
|
|
|
|
|
|
|
// `-p` enables default "summary" output, so `-s` is noop
|
|
|
|
|
let stdout = test_env.jj_cmd_success(
|
|
|
|
|
&repo_path,
|
|
|
|
|
&[
|
|
|
|
|
"log",
|
|
|
|
|
"-T",
|
|
|
|
|
"description",
|
|
|
|
|
"-p",
|
|
|
|
|
"-s",
|
2023-02-06 06:42:27 +00:00
|
|
|
|
"--config-toml=ui.diff.format='summary'",
|
2022-12-13 12:24:24 +00:00
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
insta::assert_snapshot!(stdout, @r###"
|
2023-02-09 02:53:47 +00:00
|
|
|
|
@ a new commit
|
|
|
|
|
│ M file1
|
2024-07-15 22:20:10 +00:00
|
|
|
|
○ add a file
|
2023-02-09 02:53:47 +00:00
|
|
|
|
│ A file1
|
2024-07-15 22:20:10 +00:00
|
|
|
|
◆
|
2022-12-13 12:24:24 +00:00
|
|
|
|
"###);
|
|
|
|
|
|
|
|
|
|
// `-p` enables default "color-words" diff output, so `--color-words` is noop
|
|
|
|
|
let stdout = test_env.jj_cmd_success(
|
|
|
|
|
&repo_path,
|
|
|
|
|
&["log", "-T", "description", "-p", "--color-words"],
|
|
|
|
|
);
|
|
|
|
|
insta::assert_snapshot!(stdout, @r###"
|
2023-02-09 02:53:47 +00:00
|
|
|
|
@ a new commit
|
|
|
|
|
│ Modified regular file file1:
|
|
|
|
|
│ 1 1: foo
|
|
|
|
|
│ 2: bar
|
2024-07-15 22:20:10 +00:00
|
|
|
|
○ add a file
|
2023-02-09 02:53:47 +00:00
|
|
|
|
│ Added regular file file1:
|
|
|
|
|
│ 1: foo
|
2024-07-15 22:20:10 +00:00
|
|
|
|
◆
|
2022-12-13 12:24:24 +00:00
|
|
|
|
"###);
|
|
|
|
|
|
|
|
|
|
// `--git` enables git diff, so `-p` is noop
|
2022-03-28 09:12:08 +00:00
|
|
|
|
let stdout = test_env.jj_cmd_success(
|
|
|
|
|
&repo_path,
|
|
|
|
|
&["log", "-T", "description", "--no-graph", "-p", "--git"],
|
|
|
|
|
);
|
|
|
|
|
insta::assert_snapshot!(stdout, @r###"
|
|
|
|
|
a new commit
|
|
|
|
|
diff --git a/file1 b/file1
|
2024-07-14 10:26:07 +00:00
|
|
|
|
index 257cc5642c..3bd1f0e297 100644
|
2022-03-28 09:12:08 +00:00
|
|
|
|
--- a/file1
|
|
|
|
|
+++ b/file1
|
|
|
|
|
@@ -1,1 +1,2 @@
|
|
|
|
|
foo
|
|
|
|
|
+bar
|
|
|
|
|
add a file
|
|
|
|
|
diff --git a/file1 b/file1
|
|
|
|
|
new file mode 100644
|
|
|
|
|
index 0000000000..257cc5642c
|
|
|
|
|
--- /dev/null
|
|
|
|
|
+++ b/file1
|
|
|
|
|
@@ -1,0 +1,1 @@
|
|
|
|
|
+foo
|
|
|
|
|
"###);
|
2022-05-13 05:20:10 +00:00
|
|
|
|
|
2023-03-11 04:11:58 +00:00
|
|
|
|
// Cannot use both `--git` and `--color-words`
|
|
|
|
|
let stderr = test_env.jj_cmd_cli_error(
|
2022-12-13 12:24:24 +00:00
|
|
|
|
&repo_path,
|
|
|
|
|
&[
|
|
|
|
|
"log",
|
|
|
|
|
"-T",
|
|
|
|
|
"description",
|
|
|
|
|
"--no-graph",
|
|
|
|
|
"-p",
|
|
|
|
|
"--git",
|
|
|
|
|
"--color-words",
|
|
|
|
|
],
|
|
|
|
|
);
|
2023-03-11 04:11:58 +00:00
|
|
|
|
insta::assert_snapshot!(stderr, @r###"
|
2023-03-17 23:14:20 +00:00
|
|
|
|
error: the argument '--git' cannot be used with '--color-words'
|
2023-03-11 04:11:58 +00:00
|
|
|
|
|
|
|
|
|
Usage: jj log --template <TEMPLATE> --no-graph --patch --git [PATHS]...
|
|
|
|
|
|
2023-03-17 23:14:20 +00:00
|
|
|
|
For more information, try '--help'.
|
2022-12-13 12:24:24 +00:00
|
|
|
|
"###);
|
|
|
|
|
|
|
|
|
|
// `-s` with or without graph
|
2022-05-13 05:20:10 +00:00
|
|
|
|
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-T", "description", "-s"]);
|
|
|
|
|
insta::assert_snapshot!(stdout, @r###"
|
2023-02-09 02:53:47 +00:00
|
|
|
|
@ a new commit
|
|
|
|
|
│ M file1
|
2024-07-15 22:20:10 +00:00
|
|
|
|
○ add a file
|
2023-02-09 02:53:47 +00:00
|
|
|
|
│ A file1
|
2024-07-15 22:20:10 +00:00
|
|
|
|
◆
|
2022-05-13 05:20:10 +00:00
|
|
|
|
"###);
|
|
|
|
|
let stdout = test_env.jj_cmd_success(
|
|
|
|
|
&repo_path,
|
|
|
|
|
&["log", "-T", "description", "--no-graph", "-s"],
|
|
|
|
|
);
|
|
|
|
|
insta::assert_snapshot!(stdout, @r###"
|
|
|
|
|
a new commit
|
|
|
|
|
M file1
|
|
|
|
|
add a file
|
|
|
|
|
A file1
|
|
|
|
|
"###);
|
|
|
|
|
|
|
|
|
|
// `--git` implies `-p`, with or without graph
|
|
|
|
|
let stdout = test_env.jj_cmd_success(
|
|
|
|
|
&repo_path,
|
|
|
|
|
&["log", "-T", "description", "-r", "@", "--git"],
|
|
|
|
|
);
|
|
|
|
|
insta::assert_snapshot!(stdout, @r###"
|
2023-02-09 02:53:47 +00:00
|
|
|
|
@ a new commit
|
|
|
|
|
│ diff --git a/file1 b/file1
|
2024-07-14 10:26:07 +00:00
|
|
|
|
~ index 257cc5642c..3bd1f0e297 100644
|
2023-02-09 02:53:47 +00:00
|
|
|
|
--- a/file1
|
|
|
|
|
+++ b/file1
|
|
|
|
|
@@ -1,1 +1,2 @@
|
|
|
|
|
foo
|
|
|
|
|
+bar
|
2022-05-13 05:20:10 +00:00
|
|
|
|
"###);
|
|
|
|
|
let stdout = test_env.jj_cmd_success(
|
|
|
|
|
&repo_path,
|
|
|
|
|
&["log", "-T", "description", "-r", "@", "--no-graph", "--git"],
|
|
|
|
|
);
|
|
|
|
|
insta::assert_snapshot!(stdout, @r###"
|
|
|
|
|
a new commit
|
|
|
|
|
diff --git a/file1 b/file1
|
2024-07-14 10:26:07 +00:00
|
|
|
|
index 257cc5642c..3bd1f0e297 100644
|
2022-05-13 05:20:10 +00:00
|
|
|
|
--- a/file1
|
|
|
|
|
+++ b/file1
|
|
|
|
|
@@ -1,1 +1,2 @@
|
|
|
|
|
foo
|
|
|
|
|
+bar
|
|
|
|
|
"###);
|
2022-12-14 10:48:53 +00:00
|
|
|
|
|
|
|
|
|
// `--color-words` implies `-p`, with or without graph
|
|
|
|
|
let stdout = test_env.jj_cmd_success(
|
|
|
|
|
&repo_path,
|
|
|
|
|
&["log", "-T", "description", "-r", "@", "--color-words"],
|
|
|
|
|
);
|
|
|
|
|
insta::assert_snapshot!(stdout, @r###"
|
2023-02-09 02:53:47 +00:00
|
|
|
|
@ a new commit
|
|
|
|
|
│ Modified regular file file1:
|
|
|
|
|
~ 1 1: foo
|
|
|
|
|
2: bar
|
2022-12-14 10:48:53 +00:00
|
|
|
|
"###);
|
|
|
|
|
let stdout = test_env.jj_cmd_success(
|
|
|
|
|
&repo_path,
|
|
|
|
|
&[
|
|
|
|
|
"log",
|
|
|
|
|
"-T",
|
|
|
|
|
"description",
|
|
|
|
|
"-r",
|
|
|
|
|
"@",
|
|
|
|
|
"--no-graph",
|
|
|
|
|
"--color-words",
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
insta::assert_snapshot!(stdout, @r###"
|
|
|
|
|
a new commit
|
|
|
|
|
Modified regular file file1:
|
|
|
|
|
1 1: foo
|
|
|
|
|
2: bar
|
|
|
|
|
"###);
|
2022-03-28 09:12:08 +00:00
|
|
|
|
}
|
2022-05-09 17:38:23 +00:00
|
|
|
|
|
2023-09-13 17:50:12 +00:00
|
|
|
|
#[test]
|
|
|
|
|
fn test_log_null_terminate_multiline_descriptions() {
|
|
|
|
|
let test_env = TestEnvironment::default();
|
2024-05-17 19:49:25 +00:00
|
|
|
|
test_env.jj_cmd_ok(test_env.env_root(), &["git", "init", "repo"]);
|
2023-09-13 17:50:12 +00:00
|
|
|
|
let repo_path = test_env.env_root().join("repo");
|
|
|
|
|
|
2023-10-10 11:59:18 +00:00
|
|
|
|
test_env.jj_cmd_ok(
|
2023-09-13 17:50:12 +00:00
|
|
|
|
&repo_path,
|
|
|
|
|
&["commit", "-m", "commit 1 line 1", "-m", "commit 1 line 2"],
|
|
|
|
|
);
|
2023-10-10 11:59:18 +00:00
|
|
|
|
test_env.jj_cmd_ok(
|
2023-09-13 17:50:12 +00:00
|
|
|
|
&repo_path,
|
|
|
|
|
&["commit", "-m", "commit 2 line 1", "-m", "commit 2 line 2"],
|
|
|
|
|
);
|
2023-10-10 11:59:18 +00:00
|
|
|
|
test_env.jj_cmd_ok(
|
2023-09-13 17:50:12 +00:00
|
|
|
|
&repo_path,
|
|
|
|
|
&["describe", "-m", "commit 3 line 1", "-m", "commit 3 line 2"],
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
let stdout = test_env.jj_cmd_success(
|
|
|
|
|
&repo_path,
|
|
|
|
|
&[
|
|
|
|
|
"log",
|
|
|
|
|
"-r",
|
|
|
|
|
"~root()",
|
|
|
|
|
"-T",
|
|
|
|
|
r#"description ++ "\0""#,
|
|
|
|
|
"--no-graph",
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
insta::assert_debug_snapshot!(
|
|
|
|
|
stdout,
|
|
|
|
|
@r###""commit 3 line 1\n\ncommit 3 line 2\n\0commit 2 line 1\n\ncommit 2 line 2\n\0commit 1 line 1\n\ncommit 1 line 2\n\0""###
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
2023-01-03 00:24:00 +00:00
|
|
|
|
#[test]
|
2023-02-14 13:48:49 +00:00
|
|
|
|
fn test_log_shortest_accessors() {
|
2023-01-03 00:24:00 +00:00
|
|
|
|
let test_env = TestEnvironment::default();
|
2024-05-17 19:49:25 +00:00
|
|
|
|
test_env.jj_cmd_ok(test_env.env_root(), &["git", "init", "repo"]);
|
2023-01-03 00:24:00 +00:00
|
|
|
|
let repo_path = test_env.env_root().join("repo");
|
2023-02-14 13:36:48 +00:00
|
|
|
|
let render = |rev, template| {
|
|
|
|
|
test_env.jj_cmd_success(
|
|
|
|
|
&repo_path,
|
|
|
|
|
&["log", "--no-graph", "-r", rev, "-T", template],
|
|
|
|
|
)
|
|
|
|
|
};
|
|
|
|
|
test_env.add_config(
|
2023-08-15 03:18:52 +00:00
|
|
|
|
r#"
|
2023-02-14 13:36:48 +00:00
|
|
|
|
[template-aliases]
|
2023-02-28 11:30:57 +00:00
|
|
|
|
'format_id(id)' = 'id.shortest(12).prefix() ++ "[" ++ id.shortest(12).rest() ++ "]"'
|
2023-08-15 03:18:52 +00:00
|
|
|
|
"#,
|
2023-02-14 13:36:48 +00:00
|
|
|
|
);
|
2023-01-03 00:24:00 +00:00
|
|
|
|
|
|
|
|
|
std::fs::write(repo_path.join("file"), "original file\n").unwrap();
|
2023-10-10 11:59:18 +00:00
|
|
|
|
test_env.jj_cmd_ok(&repo_path, &["describe", "-m", "initial"]);
|
2024-08-21 19:59:15 +00:00
|
|
|
|
test_env.jj_cmd_ok(&repo_path, &["bookmark", "c", "original"]);
|
2023-01-03 00:24:00 +00:00
|
|
|
|
insta::assert_snapshot!(
|
2023-02-28 11:30:57 +00:00
|
|
|
|
render("original", r#"format_id(change_id) ++ " " ++ format_id(commit_id)"#),
|
2024-06-23 22:20:33 +00:00
|
|
|
|
@"q[pvuntsmwlqt] e[0e22b9fae75]");
|
2023-02-06 07:06:44 +00:00
|
|
|
|
|
|
|
|
|
// Create a chain of 10 commits
|
|
|
|
|
for i in 1..10 {
|
2023-10-10 11:59:18 +00:00
|
|
|
|
test_env.jj_cmd_ok(&repo_path, &["new", "-m", &format!("commit{i}")]);
|
2023-01-03 00:24:00 +00:00
|
|
|
|
std::fs::write(repo_path.join("file"), format!("file {i}\n")).unwrap();
|
|
|
|
|
}
|
2023-02-06 07:06:44 +00:00
|
|
|
|
// Create 2^3 duplicates of the chain
|
|
|
|
|
for _ in 0..3 {
|
2023-10-10 11:59:18 +00:00
|
|
|
|
test_env.jj_cmd_ok(&repo_path, &["duplicate", "description(commit)"]);
|
2023-02-06 07:06:44 +00:00
|
|
|
|
}
|
|
|
|
|
|
2023-01-03 00:24:00 +00:00
|
|
|
|
insta::assert_snapshot!(
|
2023-02-28 11:30:57 +00:00
|
|
|
|
render("original", r#"format_id(change_id) ++ " " ++ format_id(commit_id)"#),
|
2024-06-23 22:20:33 +00:00
|
|
|
|
@"qpv[untsmwlqt] e0[e22b9fae75]");
|
2023-02-14 13:48:49 +00:00
|
|
|
|
|
2023-01-21 04:56:34 +00:00
|
|
|
|
insta::assert_snapshot!(
|
2023-07-28 00:33:54 +00:00
|
|
|
|
render("::@", r#"change_id.shortest() ++ " " ++ commit_id.shortest() ++ "\n""#),
|
2023-01-21 04:56:34 +00:00
|
|
|
|
@r###"
|
2024-06-23 22:20:33 +00:00
|
|
|
|
wq ed
|
|
|
|
|
km ef3
|
|
|
|
|
kp af
|
|
|
|
|
zn 23
|
|
|
|
|
yo b87
|
|
|
|
|
vr 1e
|
|
|
|
|
yq 34
|
|
|
|
|
ro cc
|
|
|
|
|
mz 1b
|
|
|
|
|
qpv e0
|
2023-02-14 13:48:49 +00:00
|
|
|
|
zzz 00
|
|
|
|
|
"###);
|
2023-02-14 13:36:48 +00:00
|
|
|
|
|
2023-05-06 00:12:08 +00:00
|
|
|
|
insta::assert_snapshot!(
|
2023-07-28 00:33:54 +00:00
|
|
|
|
render("::@", r#"format_id(change_id) ++ " " ++ format_id(commit_id) ++ "\n""#),
|
2023-05-06 00:12:08 +00:00
|
|
|
|
@r###"
|
2024-06-23 22:20:33 +00:00
|
|
|
|
wq[nwkozpkust] ed[e204633421]
|
|
|
|
|
km[kuslswpqwq] ef3[d013266cd]
|
|
|
|
|
kp[qxywonksrl] af[95b841712d]
|
|
|
|
|
zn[kkpsqqskkl] 23[c1103d3427]
|
|
|
|
|
yo[stqsxwqrlt] b87[aa9b24921]
|
|
|
|
|
vr[uxwmqvtpmx] 1e[a31a205ce9]
|
|
|
|
|
yq[osqzytrlsw] 34[befb94f4eb]
|
|
|
|
|
ro[yxmykxtrkr] cc[0c127948ef]
|
|
|
|
|
mz[vwutvlkqwt] 1b[7b715afc3f]
|
|
|
|
|
qpv[untsmwlqt] e0[e22b9fae75]
|
2023-05-06 00:12:08 +00:00
|
|
|
|
zzz[zzzzzzzzz] 00[0000000000]
|
|
|
|
|
"###);
|
|
|
|
|
|
|
|
|
|
// Can get shorter prefixes in configured revset
|
2024-02-13 05:56:46 +00:00
|
|
|
|
test_env.add_config(r#"revsets.short-prefixes = "(@----)::""#);
|
2023-05-06 00:12:08 +00:00
|
|
|
|
insta::assert_snapshot!(
|
2023-07-28 00:33:54 +00:00
|
|
|
|
render("::@", r#"format_id(change_id) ++ " " ++ format_id(commit_id) ++ "\n""#),
|
2023-05-06 00:12:08 +00:00
|
|
|
|
@r###"
|
2024-06-23 22:20:33 +00:00
|
|
|
|
w[qnwkozpkust] ed[e204633421]
|
|
|
|
|
km[kuslswpqwq] ef[3d013266cd]
|
|
|
|
|
kp[qxywonksrl] a[f95b841712d]
|
|
|
|
|
z[nkkpsqqskkl] 2[3c1103d3427]
|
|
|
|
|
y[ostqsxwqrlt] b[87aa9b24921]
|
|
|
|
|
vr[uxwmqvtpmx] 1e[a31a205ce9]
|
|
|
|
|
yq[osqzytrlsw] 34[befb94f4eb]
|
|
|
|
|
ro[yxmykxtrkr] cc[0c127948ef]
|
|
|
|
|
mz[vwutvlkqwt] 1b[7b715afc3f]
|
|
|
|
|
qpv[untsmwlqt] e0[e22b9fae75]
|
2023-05-06 00:12:08 +00:00
|
|
|
|
zzz[zzzzzzzzz] 00[0000000000]
|
|
|
|
|
"###);
|
|
|
|
|
|
|
|
|
|
// Can disable short prefixes by setting to empty string
|
|
|
|
|
test_env.add_config(r#"revsets.short-prefixes = """#);
|
2023-02-14 13:36:48 +00:00
|
|
|
|
insta::assert_snapshot!(
|
2023-07-28 00:33:54 +00:00
|
|
|
|
render("::@", r#"format_id(change_id) ++ " " ++ format_id(commit_id) ++ "\n""#),
|
2023-02-14 13:36:48 +00:00
|
|
|
|
@r###"
|
2024-06-23 22:20:33 +00:00
|
|
|
|
wq[nwkozpkust] ed[e204633421]
|
|
|
|
|
km[kuslswpqwq] ef3[d013266cd]
|
|
|
|
|
kp[qxywonksrl] af[95b841712d]
|
|
|
|
|
zn[kkpsqqskkl] 23c[1103d3427]
|
|
|
|
|
yo[stqsxwqrlt] b87[aa9b24921]
|
|
|
|
|
vr[uxwmqvtpmx] 1e[a31a205ce9]
|
|
|
|
|
yq[osqzytrlsw] 34[befb94f4eb]
|
|
|
|
|
ro[yxmykxtrkr] cc[0c127948ef]
|
|
|
|
|
mz[vwutvlkqwt] 1b[7b715afc3f]
|
|
|
|
|
qpv[untsmwlqt] e0[e22b9fae75]
|
2023-02-14 13:36:48 +00:00
|
|
|
|
zzz[zzzzzzzzz] 00[0000000000]
|
|
|
|
|
"###);
|
2023-01-21 04:56:34 +00:00
|
|
|
|
}
|
|
|
|
|
|
2023-09-30 20:16:14 +00:00
|
|
|
|
#[test]
|
|
|
|
|
fn test_log_bad_short_prefixes() {
|
|
|
|
|
let test_env = TestEnvironment::default();
|
2024-05-17 19:49:25 +00:00
|
|
|
|
test_env.jj_cmd_ok(test_env.env_root(), &["git", "init", "repo"]);
|
2023-09-30 20:16:14 +00:00
|
|
|
|
let repo_path = test_env.env_root().join("repo");
|
|
|
|
|
// Error on bad config of short prefixes
|
|
|
|
|
test_env.add_config(r#"revsets.short-prefixes = "!nval!d""#);
|
|
|
|
|
let stderr = test_env.jj_cmd_failure(&repo_path, &["status"]);
|
|
|
|
|
insta::assert_snapshot!(stderr,
|
|
|
|
|
@r###"
|
2024-03-18 00:44:39 +00:00
|
|
|
|
Config error: Invalid `revsets.short-prefixes`
|
2024-03-25 15:54:39 +00:00
|
|
|
|
Caused by: --> 1:1
|
2023-09-30 20:16:14 +00:00
|
|
|
|
|
|
|
|
|
|
1 | !nval!d
|
|
|
|
|
| ^---
|
|
|
|
|
|
|
2024-05-10 00:25:33 +00:00
|
|
|
|
= expected <identifier> or <expression>
|
2024-09-05 05:38:56 +00:00
|
|
|
|
For help, see https://martinvonz.github.io/jj/latest/config/.
|
2023-09-30 20:16:14 +00:00
|
|
|
|
"###);
|
|
|
|
|
}
|
|
|
|
|
|
2023-01-21 04:56:34 +00:00
|
|
|
|
#[test]
|
|
|
|
|
fn test_log_prefix_highlight_styled() {
|
|
|
|
|
let test_env = TestEnvironment::default();
|
2024-05-17 19:49:25 +00:00
|
|
|
|
test_env.jj_cmd_ok(test_env.env_root(), &["git", "init", "repo"]);
|
2023-01-21 04:56:34 +00:00
|
|
|
|
let repo_path = test_env.env_root().join("repo");
|
|
|
|
|
|
|
|
|
|
fn prefix_format(len: Option<usize>) -> String {
|
|
|
|
|
format!(
|
2023-02-28 10:43:14 +00:00
|
|
|
|
r###"
|
|
|
|
|
separate(" ",
|
|
|
|
|
"Change",
|
|
|
|
|
change_id.shortest({0}),
|
|
|
|
|
description.first_line(),
|
|
|
|
|
commit_id.shortest({0}),
|
2024-08-21 19:59:15 +00:00
|
|
|
|
bookmarks,
|
2023-02-28 10:43:14 +00:00
|
|
|
|
)
|
|
|
|
|
"###,
|
2023-06-05 04:57:12 +00:00
|
|
|
|
len.map(|l| l.to_string()).unwrap_or_default()
|
2023-01-21 04:56:34 +00:00
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::fs::write(repo_path.join("file"), "original file\n").unwrap();
|
2023-10-10 11:59:18 +00:00
|
|
|
|
test_env.jj_cmd_ok(&repo_path, &["describe", "-m", "initial"]);
|
2024-08-21 19:59:15 +00:00
|
|
|
|
test_env.jj_cmd_ok(&repo_path, &["bookmark", "c", "original"]);
|
2023-01-21 04:56:34 +00:00
|
|
|
|
insta::assert_snapshot!(
|
2023-02-06 05:38:54 +00:00
|
|
|
|
test_env.jj_cmd_success(&repo_path, &["log", "-r", "original", "-T", &prefix_format(Some(12))]),
|
2023-01-21 04:56:34 +00:00
|
|
|
|
@r###"
|
2024-06-23 22:20:33 +00:00
|
|
|
|
@ Change qpvuntsmwlqt initial e0e22b9fae75 original
|
2023-02-09 02:53:47 +00:00
|
|
|
|
│
|
|
|
|
|
~
|
2023-01-21 04:56:34 +00:00
|
|
|
|
"###
|
|
|
|
|
);
|
2023-02-06 07:06:44 +00:00
|
|
|
|
|
|
|
|
|
// Create a chain of 10 commits
|
|
|
|
|
for i in 1..10 {
|
2023-10-10 11:59:18 +00:00
|
|
|
|
test_env.jj_cmd_ok(&repo_path, &["new", "-m", &format!("commit{i}")]);
|
2023-01-21 04:56:34 +00:00
|
|
|
|
std::fs::write(repo_path.join("file"), format!("file {i}\n")).unwrap();
|
|
|
|
|
}
|
2023-02-06 07:06:44 +00:00
|
|
|
|
// Create 2^3 duplicates of the chain
|
|
|
|
|
for _ in 0..3 {
|
2023-10-10 11:59:18 +00:00
|
|
|
|
test_env.jj_cmd_ok(&repo_path, &["duplicate", "description(commit)"]);
|
2023-02-06 07:06:44 +00:00
|
|
|
|
}
|
|
|
|
|
|
2023-01-21 04:56:34 +00:00
|
|
|
|
insta::assert_snapshot!(
|
2023-02-06 05:38:54 +00:00
|
|
|
|
test_env.jj_cmd_success(&repo_path, &["log", "-r", "original", "-T", &prefix_format(Some(12))]),
|
2023-01-21 04:56:34 +00:00
|
|
|
|
@r###"
|
2024-07-15 22:20:10 +00:00
|
|
|
|
○ Change qpvuntsmwlqt initial e0e22b9fae75 original
|
2023-02-09 02:53:47 +00:00
|
|
|
|
│
|
|
|
|
|
~
|
2023-01-21 04:56:34 +00:00
|
|
|
|
"###
|
|
|
|
|
);
|
|
|
|
|
let stdout = test_env.jj_cmd_success(
|
|
|
|
|
&repo_path,
|
|
|
|
|
&[
|
|
|
|
|
"--color=always",
|
|
|
|
|
"log",
|
|
|
|
|
"-r",
|
|
|
|
|
"@-----------..@",
|
|
|
|
|
"-T",
|
2023-02-06 05:38:54 +00:00
|
|
|
|
&prefix_format(Some(12)),
|
2023-01-21 04:56:34 +00:00
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
insta::assert_snapshot!(stdout,
|
|
|
|
|
@r###"
|
2024-07-15 22:20:10 +00:00
|
|
|
|
[1m[38;5;2m@[0m Change [1m[38;5;5mwq[0m[38;5;8mnwkozpkust[39m commit9 [1m[38;5;4med[0m[38;5;8me204633421[39m
|
|
|
|
|
○ Change [1m[38;5;5mkm[0m[38;5;8mkuslswpqwq[39m commit8 [1m[38;5;4mef3[0m[38;5;8md013266cd[39m
|
|
|
|
|
○ Change [1m[38;5;5mkp[0m[38;5;8mqxywonksrl[39m commit7 [1m[38;5;4maf[0m[38;5;8m95b841712d[39m
|
|
|
|
|
○ Change [1m[38;5;5mzn[0m[38;5;8mkkpsqqskkl[39m commit6 [1m[38;5;4m23[0m[38;5;8mc1103d3427[39m
|
|
|
|
|
○ Change [1m[38;5;5myo[0m[38;5;8mstqsxwqrlt[39m commit5 [1m[38;5;4mb87[0m[38;5;8maa9b24921[39m
|
|
|
|
|
○ Change [1m[38;5;5mvr[0m[38;5;8muxwmqvtpmx[39m commit4 [1m[38;5;4m1e[0m[38;5;8ma31a205ce9[39m
|
|
|
|
|
○ Change [1m[38;5;5myq[0m[38;5;8mosqzytrlsw[39m commit3 [1m[38;5;4m34[0m[38;5;8mbefb94f4eb[39m
|
|
|
|
|
○ Change [1m[38;5;5mro[0m[38;5;8myxmykxtrkr[39m commit2 [1m[38;5;4mcc[0m[38;5;8m0c127948ef[39m
|
|
|
|
|
○ Change [1m[38;5;5mmz[0m[38;5;8mvwutvlkqwt[39m commit1 [1m[38;5;4m1b[0m[38;5;8m7b715afc3f[39m
|
|
|
|
|
○ Change [1m[38;5;5mqpv[0m[38;5;8muntsmwlqt[39m initial [1m[38;5;4me0[0m[38;5;8me22b9fae75[39m [38;5;5moriginal[39m
|
|
|
|
|
[1m[38;5;14m◆[0m Change [1m[38;5;5mzzz[0m[38;5;8mzzzzzzzzz[39m [1m[38;5;4m00[0m[38;5;8m0000000000[39m
|
2023-01-21 04:56:34 +00:00
|
|
|
|
"###
|
|
|
|
|
);
|
|
|
|
|
let stdout = test_env.jj_cmd_success(
|
|
|
|
|
&repo_path,
|
|
|
|
|
&[
|
|
|
|
|
"--color=always",
|
|
|
|
|
"log",
|
|
|
|
|
"-r",
|
|
|
|
|
"@-----------..@",
|
|
|
|
|
"-T",
|
|
|
|
|
&prefix_format(Some(3)),
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
insta::assert_snapshot!(stdout,
|
|
|
|
|
@r###"
|
2024-07-15 22:20:10 +00:00
|
|
|
|
[1m[38;5;2m@[0m Change [1m[38;5;5mwq[0m[38;5;8mn[39m commit9 [1m[38;5;4med[0m[38;5;8me[39m
|
|
|
|
|
○ Change [1m[38;5;5mkm[0m[38;5;8mk[39m commit8 [1m[38;5;4mef3[0m
|
|
|
|
|
○ Change [1m[38;5;5mkp[0m[38;5;8mq[39m commit7 [1m[38;5;4maf[0m[38;5;8m9[39m
|
|
|
|
|
○ Change [1m[38;5;5mzn[0m[38;5;8mk[39m commit6 [1m[38;5;4m23[0m[38;5;8mc[39m
|
|
|
|
|
○ Change [1m[38;5;5myo[0m[38;5;8ms[39m commit5 [1m[38;5;4mb87[0m
|
|
|
|
|
○ Change [1m[38;5;5mvr[0m[38;5;8mu[39m commit4 [1m[38;5;4m1e[0m[38;5;8ma[39m
|
|
|
|
|
○ Change [1m[38;5;5myq[0m[38;5;8mo[39m commit3 [1m[38;5;4m34[0m[38;5;8mb[39m
|
|
|
|
|
○ Change [1m[38;5;5mro[0m[38;5;8my[39m commit2 [1m[38;5;4mcc[0m[38;5;8m0[39m
|
|
|
|
|
○ Change [1m[38;5;5mmz[0m[38;5;8mv[39m commit1 [1m[38;5;4m1b[0m[38;5;8m7[39m
|
|
|
|
|
○ Change [1m[38;5;5mqpv[0m initial [1m[38;5;4me0[0m[38;5;8me[39m [38;5;5moriginal[39m
|
|
|
|
|
[1m[38;5;14m◆[0m Change [1m[38;5;5mzzz[0m [1m[38;5;4m00[0m[38;5;8m0[39m
|
2023-01-21 04:56:34 +00:00
|
|
|
|
"###
|
|
|
|
|
);
|
|
|
|
|
let stdout = test_env.jj_cmd_success(
|
|
|
|
|
&repo_path,
|
|
|
|
|
&[
|
|
|
|
|
"--color=always",
|
|
|
|
|
"log",
|
|
|
|
|
"-r",
|
|
|
|
|
"@-----------..@",
|
|
|
|
|
"-T",
|
2023-02-06 05:38:54 +00:00
|
|
|
|
&prefix_format(None),
|
2023-01-21 04:56:34 +00:00
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
insta::assert_snapshot!(stdout,
|
2023-01-03 00:24:00 +00:00
|
|
|
|
@r###"
|
2024-07-15 22:20:10 +00:00
|
|
|
|
[1m[38;5;2m@[0m Change [1m[38;5;5mwq[0m commit9 [1m[38;5;4med[0m
|
|
|
|
|
○ Change [1m[38;5;5mkm[0m commit8 [1m[38;5;4mef3[0m
|
|
|
|
|
○ Change [1m[38;5;5mkp[0m commit7 [1m[38;5;4maf[0m
|
|
|
|
|
○ Change [1m[38;5;5mzn[0m commit6 [1m[38;5;4m23[0m
|
|
|
|
|
○ Change [1m[38;5;5myo[0m commit5 [1m[38;5;4mb87[0m
|
|
|
|
|
○ Change [1m[38;5;5mvr[0m commit4 [1m[38;5;4m1e[0m
|
|
|
|
|
○ Change [1m[38;5;5myq[0m commit3 [1m[38;5;4m34[0m
|
|
|
|
|
○ Change [1m[38;5;5mro[0m commit2 [1m[38;5;4mcc[0m
|
|
|
|
|
○ Change [1m[38;5;5mmz[0m commit1 [1m[38;5;4m1b[0m
|
|
|
|
|
○ Change [1m[38;5;5mqpv[0m initial [1m[38;5;4me0[0m [38;5;5moriginal[39m
|
|
|
|
|
[1m[38;5;14m◆[0m Change [1m[38;5;5mzzz[0m [1m[38;5;4m00[0m
|
2023-01-03 00:24:00 +00:00
|
|
|
|
"###
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
|
fn test_log_prefix_highlight_counts_hidden_commits() {
|
|
|
|
|
let test_env = TestEnvironment::default();
|
2024-05-17 19:49:25 +00:00
|
|
|
|
test_env.jj_cmd_ok(test_env.env_root(), &["git", "init", "repo"]);
|
2023-01-03 00:24:00 +00:00
|
|
|
|
let repo_path = test_env.env_root().join("repo");
|
2023-02-14 13:48:49 +00:00
|
|
|
|
test_env.add_config(
|
2023-08-15 03:18:52 +00:00
|
|
|
|
r#"
|
2023-05-22 03:27:03 +00:00
|
|
|
|
[revsets]
|
|
|
|
|
short-prefixes = "" # Disable short prefixes
|
2023-02-14 13:48:49 +00:00
|
|
|
|
[template-aliases]
|
2023-02-28 11:30:57 +00:00
|
|
|
|
'format_id(id)' = 'id.shortest(12).prefix() ++ "[" ++ id.shortest(12).rest() ++ "]"'
|
2023-08-15 03:18:52 +00:00
|
|
|
|
"#,
|
2023-02-14 13:48:49 +00:00
|
|
|
|
);
|
2023-01-03 00:24:00 +00:00
|
|
|
|
|
2023-08-15 03:18:52 +00:00
|
|
|
|
let prefix_format = r#"
|
2023-02-28 10:43:14 +00:00
|
|
|
|
separate(" ",
|
|
|
|
|
"Change",
|
|
|
|
|
format_id(change_id),
|
|
|
|
|
description.first_line(),
|
|
|
|
|
format_id(commit_id),
|
2024-08-21 19:59:15 +00:00
|
|
|
|
bookmarks,
|
2023-02-28 10:43:14 +00:00
|
|
|
|
)
|
2023-08-15 03:18:52 +00:00
|
|
|
|
"#;
|
2023-01-03 00:24:00 +00:00
|
|
|
|
|
|
|
|
|
std::fs::write(repo_path.join("file"), "original file\n").unwrap();
|
2023-10-10 11:59:18 +00:00
|
|
|
|
test_env.jj_cmd_ok(&repo_path, &["describe", "-m", "initial"]);
|
2024-08-21 19:59:15 +00:00
|
|
|
|
test_env.jj_cmd_ok(&repo_path, &["bookmark", "c", "original"]);
|
2023-01-03 00:24:00 +00:00
|
|
|
|
insta::assert_snapshot!(
|
|
|
|
|
test_env.jj_cmd_success(&repo_path, &["log", "-r", "all()", "-T", prefix_format]),
|
|
|
|
|
@r###"
|
2024-06-23 22:20:33 +00:00
|
|
|
|
@ Change q[pvuntsmwlqt] initial e0[e22b9fae75] original
|
2024-07-15 22:20:10 +00:00
|
|
|
|
◆ Change z[zzzzzzzzzzz] 0[00000000000]
|
2023-01-03 00:24:00 +00:00
|
|
|
|
"###
|
|
|
|
|
);
|
2023-02-06 07:06:44 +00:00
|
|
|
|
|
|
|
|
|
// Create 2^7 hidden commits
|
2023-10-10 11:59:18 +00:00
|
|
|
|
test_env.jj_cmd_ok(&repo_path, &["new", "root()", "-m", "extra"]);
|
2023-02-06 07:06:44 +00:00
|
|
|
|
for _ in 0..7 {
|
2023-10-10 11:59:18 +00:00
|
|
|
|
test_env.jj_cmd_ok(&repo_path, &["duplicate", "description(extra)"]);
|
2023-01-03 00:24:00 +00:00
|
|
|
|
}
|
2023-10-10 11:59:18 +00:00
|
|
|
|
test_env.jj_cmd_ok(&repo_path, &["abandon", "description(extra)"]);
|
2023-02-06 07:06:44 +00:00
|
|
|
|
|
2023-05-22 03:27:03 +00:00
|
|
|
|
// The unique prefixes became longer.
|
2023-01-03 00:24:00 +00:00
|
|
|
|
insta::assert_snapshot!(
|
2023-02-06 07:06:44 +00:00
|
|
|
|
test_env.jj_cmd_success(&repo_path, &["log", "-T", prefix_format]),
|
2023-01-03 00:24:00 +00:00
|
|
|
|
@r###"
|
index: switch to persistent change id index
The shortest change id prefix will become a few digits longer, but I think
that's acceptable. Entries included in the "revsets.short-prefixes" set are
unaffected.
The reachable set is calculated eagerly, but this is still faster as we no
longer need to sort the reachable entries by change id. The lazy version will
save another ~100ms in mid-size repos.
"jj log" without working copy snapshot:
```
% hyperfine --sort command --warmup 3 --runs 20 -L bin jj-0,jj-1,jj-2 \
-s "target/release-with-debug/{bin} -R ~/mirrors/linux debug reindex" \
"target/release-with-debug/{bin} -R ~/mirrors/linux \
--ignore-working-copy log -r.. -l100 --config-toml='revsets.short-prefixes=\"\"'"
Benchmark 1: target/release-with-debug/jj-0 -R ~/mirrors/linux --ignore-working-copy log -r.. -l100 --config-toml='revsets.short-prefixes=""'
Time (mean ± σ): 353.6 ms ± 11.9 ms [User: 266.7 ms, System: 87.0 ms]
Range (min … max): 329.0 ms … 365.6 ms 20 runs
Benchmark 2: target/release-with-debug/jj-1 -R ~/mirrors/linux --ignore-working-copy log -r.. -l100 --config-toml='revsets.short-prefixes=""'
Time (mean ± σ): 271.3 ms ± 9.9 ms [User: 183.8 ms, System: 87.7 ms]
Range (min … max): 250.5 ms … 282.7 ms 20 runs
Relative speed comparison
1.99 ± 0.16 target/release-with-debug/jj-0 -R ~/mirrors/linux --ignore-working-copy log -r.. -l100 --config-toml='revsets.short-prefixes=""'
1.53 ± 0.12 target/release-with-debug/jj-1 -R ~/mirrors/linux --ignore-working-copy log -r.. -l100 --config-toml='revsets.short-prefixes=""'
```
"jj status" with working copy snapshot (watchman enabled):
```
% hyperfine --sort command --warmup 3 --runs 20 -L bin jj-0,jj-1,jj-2 \
-s "target/release-with-debug/{bin} -R ~/mirrors/linux debug reindex" \
"target/release-with-debug/{bin} -R ~/mirrors/linux \
status --config-toml='revsets.short-prefixes=\"\"'"
Benchmark 1: target/release-with-debug/jj-0 -R ~/mirrors/linux status --config-toml='revsets.short-prefixes=""'
Time (mean ± σ): 396.6 ms ± 10.1 ms [User: 300.7 ms, System: 94.0 ms]
Range (min … max): 373.6 ms … 408.0 ms 20 runs
Benchmark 2: target/release-with-debug/jj-1 -R ~/mirrors/linux status --config-toml='revsets.short-prefixes=""'
Time (mean ± σ): 318.6 ms ± 12.6 ms [User: 219.1 ms, System: 94.1 ms]
Range (min … max): 294.2 ms … 333.0 ms 20 runs
Relative speed comparison
1.85 ± 0.14 target/release-with-debug/jj-0 -R ~/mirrors/linux status --config-toml='revsets.short-prefixes=""'
1.48 ± 0.12 target/release-with-debug/jj-1 -R ~/mirrors/linux status --config-toml='revsets.short-prefixes=""'
```
2023-12-22 08:32:49 +00:00
|
|
|
|
@ Change wq[nwkozpkust] 44[4c3c5066d3]
|
2024-07-15 22:20:10 +00:00
|
|
|
|
│ ○ Change qpv[untsmwlqt] initial e0e[22b9fae75] original
|
2023-02-09 02:53:47 +00:00
|
|
|
|
├─╯
|
2024-07-15 22:20:10 +00:00
|
|
|
|
◆ Change zzz[zzzzzzzzz] 00[0000000000]
|
2023-01-03 00:24:00 +00:00
|
|
|
|
"###
|
|
|
|
|
);
|
|
|
|
|
insta::assert_snapshot!(
|
2023-05-22 03:46:55 +00:00
|
|
|
|
test_env.jj_cmd_failure(&repo_path, &["log", "-r", "4", "-T", prefix_format]),
|
2023-01-03 00:24:00 +00:00
|
|
|
|
@r###"
|
2023-05-31 04:07:48 +00:00
|
|
|
|
Error: Commit ID prefix "4" is ambiguous
|
2023-01-03 00:24:00 +00:00
|
|
|
|
"###
|
|
|
|
|
);
|
|
|
|
|
insta::assert_snapshot!(
|
2023-05-22 03:46:55 +00:00
|
|
|
|
test_env.jj_cmd_success(&repo_path, &["log", "-r", "44", "-T", prefix_format]),
|
2023-01-03 00:24:00 +00:00
|
|
|
|
@r###"
|
index: switch to persistent change id index
The shortest change id prefix will become a few digits longer, but I think
that's acceptable. Entries included in the "revsets.short-prefixes" set are
unaffected.
The reachable set is calculated eagerly, but this is still faster as we no
longer need to sort the reachable entries by change id. The lazy version will
save another ~100ms in mid-size repos.
"jj log" without working copy snapshot:
```
% hyperfine --sort command --warmup 3 --runs 20 -L bin jj-0,jj-1,jj-2 \
-s "target/release-with-debug/{bin} -R ~/mirrors/linux debug reindex" \
"target/release-with-debug/{bin} -R ~/mirrors/linux \
--ignore-working-copy log -r.. -l100 --config-toml='revsets.short-prefixes=\"\"'"
Benchmark 1: target/release-with-debug/jj-0 -R ~/mirrors/linux --ignore-working-copy log -r.. -l100 --config-toml='revsets.short-prefixes=""'
Time (mean ± σ): 353.6 ms ± 11.9 ms [User: 266.7 ms, System: 87.0 ms]
Range (min … max): 329.0 ms … 365.6 ms 20 runs
Benchmark 2: target/release-with-debug/jj-1 -R ~/mirrors/linux --ignore-working-copy log -r.. -l100 --config-toml='revsets.short-prefixes=""'
Time (mean ± σ): 271.3 ms ± 9.9 ms [User: 183.8 ms, System: 87.7 ms]
Range (min … max): 250.5 ms … 282.7 ms 20 runs
Relative speed comparison
1.99 ± 0.16 target/release-with-debug/jj-0 -R ~/mirrors/linux --ignore-working-copy log -r.. -l100 --config-toml='revsets.short-prefixes=""'
1.53 ± 0.12 target/release-with-debug/jj-1 -R ~/mirrors/linux --ignore-working-copy log -r.. -l100 --config-toml='revsets.short-prefixes=""'
```
"jj status" with working copy snapshot (watchman enabled):
```
% hyperfine --sort command --warmup 3 --runs 20 -L bin jj-0,jj-1,jj-2 \
-s "target/release-with-debug/{bin} -R ~/mirrors/linux debug reindex" \
"target/release-with-debug/{bin} -R ~/mirrors/linux \
status --config-toml='revsets.short-prefixes=\"\"'"
Benchmark 1: target/release-with-debug/jj-0 -R ~/mirrors/linux status --config-toml='revsets.short-prefixes=""'
Time (mean ± σ): 396.6 ms ± 10.1 ms [User: 300.7 ms, System: 94.0 ms]
Range (min … max): 373.6 ms … 408.0 ms 20 runs
Benchmark 2: target/release-with-debug/jj-1 -R ~/mirrors/linux status --config-toml='revsets.short-prefixes=""'
Time (mean ± σ): 318.6 ms ± 12.6 ms [User: 219.1 ms, System: 94.1 ms]
Range (min … max): 294.2 ms … 333.0 ms 20 runs
Relative speed comparison
1.85 ± 0.14 target/release-with-debug/jj-0 -R ~/mirrors/linux status --config-toml='revsets.short-prefixes=""'
1.48 ± 0.12 target/release-with-debug/jj-1 -R ~/mirrors/linux status --config-toml='revsets.short-prefixes=""'
```
2023-12-22 08:32:49 +00:00
|
|
|
|
@ Change wq[nwkozpkust] 44[4c3c5066d3]
|
2023-02-09 02:53:47 +00:00
|
|
|
|
│
|
|
|
|
|
~
|
2023-01-03 00:24:00 +00:00
|
|
|
|
"###
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2023-02-06 06:52:16 +00:00
|
|
|
|
#[test]
|
2023-08-25 10:04:54 +00:00
|
|
|
|
fn test_log_short_shortest_length_parameter() {
|
2023-02-06 06:52:16 +00:00
|
|
|
|
let test_env = TestEnvironment::default();
|
2024-05-17 19:49:25 +00:00
|
|
|
|
test_env.jj_cmd_ok(test_env.env_root(), &["git", "init", "repo"]);
|
2023-02-06 06:52:16 +00:00
|
|
|
|
let repo_path = test_env.env_root().join("repo");
|
2023-08-25 10:04:54 +00:00
|
|
|
|
let render = |template| test_env.jj_cmd_success(&repo_path, &["log", "-T", template]);
|
2023-02-06 06:52:16 +00:00
|
|
|
|
|
|
|
|
|
insta::assert_snapshot!(
|
2023-08-25 10:04:54 +00:00
|
|
|
|
render(r#"commit_id.short(0) ++ "|" ++ commit_id.shortest(0)"#), @r###"
|
|
|
|
|
@ |2
|
2024-07-15 22:20:10 +00:00
|
|
|
|
◆ |0
|
2023-02-06 06:52:16 +00:00
|
|
|
|
"###);
|
2023-08-22 18:40:51 +00:00
|
|
|
|
insta::assert_snapshot!(
|
2023-08-25 10:04:54 +00:00
|
|
|
|
render(r#"commit_id.short(-0) ++ "|" ++ commit_id.shortest(-0)"#), @r###"
|
|
|
|
|
@ |2
|
2024-07-15 22:20:10 +00:00
|
|
|
|
◆ |0
|
2023-08-22 18:40:51 +00:00
|
|
|
|
"###);
|
|
|
|
|
insta::assert_snapshot!(
|
2023-08-25 10:04:54 +00:00
|
|
|
|
render(r#"commit_id.short(-100) ++ "|" ++ commit_id.shortest(-100)"#), @r###"
|
2024-02-27 11:37:00 +00:00
|
|
|
|
@ <Error: out of range integral type conversion attempted>|<Error: out of range integral type conversion attempted>
|
2024-07-15 22:20:10 +00:00
|
|
|
|
◆ <Error: out of range integral type conversion attempted>|<Error: out of range integral type conversion attempted>
|
2023-08-22 18:40:51 +00:00
|
|
|
|
"###);
|
2023-02-06 06:52:16 +00:00
|
|
|
|
insta::assert_snapshot!(
|
2023-08-25 10:04:54 +00:00
|
|
|
|
render(r#"commit_id.short(100) ++ "|" ++ commit_id.shortest(100)"#), @r###"
|
|
|
|
|
@ 230dd059e1b059aefc0da06a2e5a7dbf22362f22|230dd059e1b059aefc0da06a2e5a7dbf22362f22
|
2024-07-15 22:20:10 +00:00
|
|
|
|
◆ 0000000000000000000000000000000000000000|0000000000000000000000000000000000000000
|
2023-02-06 06:52:16 +00:00
|
|
|
|
"###);
|
|
|
|
|
}
|
|
|
|
|
|
2023-02-11 11:07:58 +00:00
|
|
|
|
#[test]
|
2023-02-15 10:58:18 +00:00
|
|
|
|
fn test_log_author_format() {
|
2023-02-11 11:07:58 +00:00
|
|
|
|
let test_env = TestEnvironment::default();
|
2024-05-17 19:49:25 +00:00
|
|
|
|
test_env.jj_cmd_ok(test_env.env_root(), &["git", "init", "repo"]);
|
2023-02-11 11:07:58 +00:00
|
|
|
|
let repo_path = test_env.env_root().join("repo");
|
|
|
|
|
|
|
|
|
|
insta::assert_snapshot!(
|
|
|
|
|
test_env.jj_cmd_success(&repo_path, &["log", "--revisions=@"]),
|
|
|
|
|
@r###"
|
2024-02-12 07:26:19 +00:00
|
|
|
|
@ qpvuntsm test.user@example.com 2001-02-03 08:05:07 230dd059
|
2023-02-09 02:53:47 +00:00
|
|
|
|
│ (empty) (no description set)
|
|
|
|
|
~
|
|
|
|
|
"###
|
2023-02-11 11:07:58 +00:00
|
|
|
|
);
|
2023-02-15 10:58:18 +00:00
|
|
|
|
|
|
|
|
|
let decl = "template-aliases.'format_short_signature(signature)'";
|
2023-02-11 11:07:58 +00:00
|
|
|
|
insta::assert_snapshot!(
|
|
|
|
|
test_env.jj_cmd_success(
|
|
|
|
|
&repo_path,
|
|
|
|
|
&[
|
2023-02-15 10:58:18 +00:00
|
|
|
|
"--config-toml",
|
|
|
|
|
&format!("{decl}='signature.username()'"),
|
2023-02-11 11:07:58 +00:00
|
|
|
|
"log",
|
|
|
|
|
"--revisions=@",
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
@r###"
|
2024-02-12 07:26:19 +00:00
|
|
|
|
@ qpvuntsm test.user 2001-02-03 08:05:07 230dd059
|
2023-02-09 02:53:47 +00:00
|
|
|
|
│ (empty) (no description set)
|
|
|
|
|
~
|
|
|
|
|
"###
|
2023-02-11 11:07:58 +00:00
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2023-01-02 07:09:38 +00:00
|
|
|
|
#[test]
|
|
|
|
|
fn test_log_divergence() {
|
|
|
|
|
let test_env = TestEnvironment::default();
|
2024-05-17 19:49:25 +00:00
|
|
|
|
test_env.jj_cmd_ok(test_env.env_root(), &["git", "init", "repo"]);
|
2023-01-02 07:09:38 +00:00
|
|
|
|
let repo_path = test_env.env_root().join("repo");
|
2023-02-28 11:30:57 +00:00
|
|
|
|
let template = r#"description.first_line() ++ if(divergent, " !divergence!")"#;
|
2023-01-02 07:09:38 +00:00
|
|
|
|
|
|
|
|
|
std::fs::write(repo_path.join("file"), "foo\n").unwrap();
|
2023-10-10 11:59:18 +00:00
|
|
|
|
test_env.jj_cmd_ok(&repo_path, &["describe", "-m", "description 1"]);
|
2023-02-28 10:43:14 +00:00
|
|
|
|
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-T", template]);
|
2023-01-02 07:09:38 +00:00
|
|
|
|
// No divergence
|
|
|
|
|
insta::assert_snapshot!(stdout, @r###"
|
2023-02-09 02:53:47 +00:00
|
|
|
|
@ description 1
|
2024-07-15 22:20:10 +00:00
|
|
|
|
◆
|
2023-01-02 07:09:38 +00:00
|
|
|
|
"###);
|
|
|
|
|
|
|
|
|
|
// Create divergence
|
2023-10-10 11:59:18 +00:00
|
|
|
|
test_env.jj_cmd_ok(
|
2023-01-02 07:09:38 +00:00
|
|
|
|
&repo_path,
|
|
|
|
|
&["describe", "-m", "description 2", "--at-operation", "@-"],
|
|
|
|
|
);
|
2023-10-10 11:59:18 +00:00
|
|
|
|
let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["log", "-T", template]);
|
2023-01-02 07:09:38 +00:00
|
|
|
|
insta::assert_snapshot!(stdout, @r###"
|
2024-07-15 22:20:10 +00:00
|
|
|
|
○ description 2 !divergence!
|
2023-02-09 02:53:47 +00:00
|
|
|
|
│ @ description 1 !divergence!
|
|
|
|
|
├─╯
|
2024-07-15 22:20:10 +00:00
|
|
|
|
◆
|
2023-01-02 07:09:38 +00:00
|
|
|
|
"###);
|
2023-10-10 11:07:06 +00:00
|
|
|
|
insta::assert_snapshot!(stderr, @r###"
|
|
|
|
|
Concurrent modification detected, resolving automatically.
|
|
|
|
|
"###);
|
2023-01-02 07:09:38 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-09 17:38:23 +00:00
|
|
|
|
#[test]
|
|
|
|
|
fn test_log_reversed() {
|
|
|
|
|
let test_env = TestEnvironment::default();
|
2024-05-17 19:49:25 +00:00
|
|
|
|
test_env.jj_cmd_ok(test_env.env_root(), &["git", "init", "repo"]);
|
2022-05-09 17:38:23 +00:00
|
|
|
|
let repo_path = test_env.env_root().join("repo");
|
|
|
|
|
|
2023-10-10 11:59:18 +00:00
|
|
|
|
test_env.jj_cmd_ok(&repo_path, &["describe", "-m", "first"]);
|
|
|
|
|
test_env.jj_cmd_ok(&repo_path, &["new", "-m", "second"]);
|
2022-05-09 17:38:23 +00:00
|
|
|
|
|
|
|
|
|
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-T", "description", "--reversed"]);
|
|
|
|
|
insta::assert_snapshot!(stdout, @r###"
|
2024-07-15 22:20:10 +00:00
|
|
|
|
◆
|
|
|
|
|
○ first
|
2023-02-09 02:53:47 +00:00
|
|
|
|
@ second
|
2022-05-09 17:38:23 +00:00
|
|
|
|
"###);
|
|
|
|
|
|
|
|
|
|
let stdout = test_env.jj_cmd_success(
|
|
|
|
|
&repo_path,
|
|
|
|
|
&["log", "-T", "description", "--reversed", "--no-graph"],
|
|
|
|
|
);
|
|
|
|
|
insta::assert_snapshot!(stdout, @r###"
|
|
|
|
|
first
|
|
|
|
|
second
|
|
|
|
|
"###);
|
|
|
|
|
}
|
2022-09-13 07:26:23 +00:00
|
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
|
fn test_log_filtered_by_path() {
|
|
|
|
|
let test_env = TestEnvironment::default();
|
2024-05-17 19:49:25 +00:00
|
|
|
|
test_env.jj_cmd_ok(test_env.env_root(), &["git", "init", "repo"]);
|
2022-09-13 07:26:23 +00:00
|
|
|
|
let repo_path = test_env.env_root().join("repo");
|
|
|
|
|
|
|
|
|
|
std::fs::write(repo_path.join("file1"), "foo\n").unwrap();
|
2023-10-10 11:59:18 +00:00
|
|
|
|
test_env.jj_cmd_ok(&repo_path, &["describe", "-m", "first"]);
|
|
|
|
|
test_env.jj_cmd_ok(&repo_path, &["new", "-m", "second"]);
|
2022-09-13 07:26:23 +00:00
|
|
|
|
std::fs::write(repo_path.join("file1"), "foo\nbar\n").unwrap();
|
|
|
|
|
std::fs::write(repo_path.join("file2"), "baz\n").unwrap();
|
|
|
|
|
|
|
|
|
|
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-T", "description", "file1"]);
|
|
|
|
|
insta::assert_snapshot!(stdout, @r###"
|
2023-02-09 02:53:47 +00:00
|
|
|
|
@ second
|
2024-07-15 22:20:10 +00:00
|
|
|
|
○ first
|
2023-02-09 02:53:47 +00:00
|
|
|
|
│
|
|
|
|
|
~
|
2022-09-13 07:26:23 +00:00
|
|
|
|
"###);
|
|
|
|
|
|
|
|
|
|
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-T", "description", "file2"]);
|
|
|
|
|
insta::assert_snapshot!(stdout, @r###"
|
2023-02-09 02:53:47 +00:00
|
|
|
|
@ second
|
|
|
|
|
│
|
|
|
|
|
~
|
2022-09-13 07:26:23 +00:00
|
|
|
|
"###);
|
|
|
|
|
|
|
|
|
|
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-T", "description", "-s", "file1"]);
|
|
|
|
|
insta::assert_snapshot!(stdout, @r###"
|
2023-02-09 02:53:47 +00:00
|
|
|
|
@ second
|
|
|
|
|
│ M file1
|
2024-07-15 22:20:10 +00:00
|
|
|
|
○ first
|
2023-02-09 02:53:47 +00:00
|
|
|
|
│ A file1
|
|
|
|
|
~
|
2022-09-13 07:26:23 +00:00
|
|
|
|
"###);
|
|
|
|
|
|
|
|
|
|
let stdout = test_env.jj_cmd_success(
|
|
|
|
|
&repo_path,
|
|
|
|
|
&["log", "-T", "description", "-s", "file2", "--no-graph"],
|
|
|
|
|
);
|
|
|
|
|
insta::assert_snapshot!(stdout, @r###"
|
|
|
|
|
second
|
|
|
|
|
A file2
|
|
|
|
|
"###);
|
2022-10-23 04:14:00 +00:00
|
|
|
|
|
2024-07-23 10:16:22 +00:00
|
|
|
|
// Fileset/pattern syntax can be disabled.
|
2024-04-11 09:04:38 +00:00
|
|
|
|
let stderr = test_env.jj_cmd_failure(
|
|
|
|
|
test_env.env_root(),
|
2024-07-23 10:16:22 +00:00
|
|
|
|
&[
|
|
|
|
|
"log",
|
|
|
|
|
"--config-toml=ui.allow-filesets=false",
|
|
|
|
|
"-R",
|
|
|
|
|
repo_path.to_str().unwrap(),
|
|
|
|
|
"all()",
|
|
|
|
|
],
|
2024-04-11 09:04:38 +00:00
|
|
|
|
);
|
|
|
|
|
insta::assert_snapshot!(stderr.replace('\\', "/"), @r###"
|
2024-04-08 07:43:18 +00:00
|
|
|
|
Error: Path "all()" is not in the repo "repo"
|
|
|
|
|
Caused by: Invalid component ".." in repo-relative path "../all()"
|
2024-04-11 09:04:38 +00:00
|
|
|
|
"###);
|
|
|
|
|
|
2024-04-08 07:43:18 +00:00
|
|
|
|
// empty revisions are filtered out by "all()" fileset.
|
|
|
|
|
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-Tdescription", "-s", "all()"]);
|
|
|
|
|
insta::assert_snapshot!(stdout, @r###"
|
|
|
|
|
@ second
|
|
|
|
|
│ M file1
|
|
|
|
|
│ A file2
|
2024-07-15 22:20:10 +00:00
|
|
|
|
○ first
|
2024-04-08 07:43:18 +00:00
|
|
|
|
│ A file1
|
|
|
|
|
~
|
|
|
|
|
"###);
|
|
|
|
|
|
2024-04-06 07:46:24 +00:00
|
|
|
|
// "root:<path>" is resolved relative to the workspace root.
|
|
|
|
|
let stdout = test_env.jj_cmd_success(
|
|
|
|
|
test_env.env_root(),
|
|
|
|
|
&[
|
|
|
|
|
"log",
|
|
|
|
|
"-R",
|
|
|
|
|
repo_path.to_str().unwrap(),
|
|
|
|
|
"-Tdescription",
|
|
|
|
|
"-s",
|
|
|
|
|
"root:file1",
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
insta::assert_snapshot!(stdout.replace('\\', "/"), @r###"
|
|
|
|
|
@ second
|
|
|
|
|
│ M repo/file1
|
2024-07-15 22:20:10 +00:00
|
|
|
|
○ first
|
2024-04-06 07:46:24 +00:00
|
|
|
|
│ A repo/file1
|
|
|
|
|
~
|
|
|
|
|
"###);
|
|
|
|
|
|
2022-10-23 04:14:00 +00:00
|
|
|
|
// file() revset doesn't filter the diff.
|
|
|
|
|
let stdout = test_env.jj_cmd_success(
|
|
|
|
|
&repo_path,
|
|
|
|
|
&[
|
|
|
|
|
"log",
|
|
|
|
|
"-T",
|
|
|
|
|
"description",
|
|
|
|
|
"-s",
|
|
|
|
|
"-rfile(file2)",
|
|
|
|
|
"--no-graph",
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
insta::assert_snapshot!(stdout, @r###"
|
|
|
|
|
second
|
|
|
|
|
M file1
|
|
|
|
|
A file2
|
|
|
|
|
"###);
|
2022-09-13 07:26:23 +00:00
|
|
|
|
}
|
2022-10-01 15:09:32 +00:00
|
|
|
|
|
2023-08-10 09:14:54 +00:00
|
|
|
|
#[test]
|
|
|
|
|
fn test_log_limit() {
|
|
|
|
|
let test_env = TestEnvironment::default();
|
2024-05-17 19:49:25 +00:00
|
|
|
|
test_env.jj_cmd_ok(test_env.env_root(), &["git", "init", "repo"]);
|
2023-08-10 09:14:54 +00:00
|
|
|
|
let repo_path = test_env.env_root().join("repo");
|
|
|
|
|
|
2023-10-10 11:59:18 +00:00
|
|
|
|
test_env.jj_cmd_ok(&repo_path, &["describe", "-m", "a"]);
|
2023-08-10 09:14:54 +00:00
|
|
|
|
std::fs::write(repo_path.join("a"), "").unwrap();
|
2023-10-10 11:59:18 +00:00
|
|
|
|
test_env.jj_cmd_ok(&repo_path, &["new", "-m", "b"]);
|
2023-08-10 09:14:54 +00:00
|
|
|
|
std::fs::write(repo_path.join("b"), "").unwrap();
|
2023-10-10 11:59:18 +00:00
|
|
|
|
test_env.jj_cmd_ok(&repo_path, &["new", "-m", "c", "description(a)"]);
|
2023-08-10 09:14:54 +00:00
|
|
|
|
std::fs::write(repo_path.join("c"), "").unwrap();
|
2023-10-10 11:59:18 +00:00
|
|
|
|
test_env.jj_cmd_ok(
|
2023-08-10 09:14:54 +00:00
|
|
|
|
&repo_path,
|
|
|
|
|
&["new", "-m", "d", "description(c)", "description(b)"],
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-T", "description", "--limit=3"]);
|
|
|
|
|
insta::assert_snapshot!(stdout, @r###"
|
|
|
|
|
@ d
|
|
|
|
|
├─╮
|
2024-07-15 22:20:10 +00:00
|
|
|
|
│ ○ b
|
|
|
|
|
○ │ c
|
2023-08-10 09:14:54 +00:00
|
|
|
|
├─╯
|
|
|
|
|
"###);
|
|
|
|
|
|
|
|
|
|
// Applied on sorted DAG
|
|
|
|
|
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-T", "description", "--limit=2"]);
|
|
|
|
|
insta::assert_snapshot!(stdout, @r###"
|
|
|
|
|
@ d
|
|
|
|
|
├─╮
|
2024-07-15 22:20:10 +00:00
|
|
|
|
│ ○ b
|
2023-08-10 09:14:54 +00:00
|
|
|
|
"###);
|
|
|
|
|
|
|
|
|
|
let stdout = test_env.jj_cmd_success(
|
|
|
|
|
&repo_path,
|
|
|
|
|
&["log", "-T", "description", "--limit=2", "--no-graph"],
|
|
|
|
|
);
|
|
|
|
|
insta::assert_snapshot!(stdout, @r###"
|
|
|
|
|
d
|
|
|
|
|
c
|
|
|
|
|
"###);
|
|
|
|
|
|
|
|
|
|
// Applied on reversed DAG
|
|
|
|
|
let stdout = test_env.jj_cmd_success(
|
|
|
|
|
&repo_path,
|
|
|
|
|
&["log", "-T", "description", "--limit=3", "--reversed"],
|
|
|
|
|
);
|
|
|
|
|
insta::assert_snapshot!(stdout, @r###"
|
2024-07-15 22:20:10 +00:00
|
|
|
|
◆
|
|
|
|
|
○ a
|
2023-08-10 09:14:54 +00:00
|
|
|
|
├─╮
|
2024-07-15 22:20:10 +00:00
|
|
|
|
│ ○ c
|
2023-08-10 09:14:54 +00:00
|
|
|
|
"###);
|
|
|
|
|
let stdout = test_env.jj_cmd_success(
|
|
|
|
|
&repo_path,
|
|
|
|
|
&[
|
|
|
|
|
"log",
|
|
|
|
|
"-T",
|
|
|
|
|
"description",
|
|
|
|
|
"--limit=3",
|
|
|
|
|
"--reversed",
|
|
|
|
|
"--no-graph",
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
insta::assert_snapshot!(stdout, @r###"
|
|
|
|
|
a
|
|
|
|
|
b
|
|
|
|
|
"###);
|
|
|
|
|
|
|
|
|
|
// Applied on filtered commits
|
|
|
|
|
let stdout = test_env.jj_cmd_success(
|
|
|
|
|
&repo_path,
|
|
|
|
|
&["log", "-T", "description", "--limit=1", "b", "c"],
|
|
|
|
|
);
|
|
|
|
|
insta::assert_snapshot!(stdout, @r###"
|
2024-07-15 22:20:10 +00:00
|
|
|
|
○ c
|
2023-08-10 09:14:54 +00:00
|
|
|
|
│
|
|
|
|
|
~
|
|
|
|
|
"###);
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-18 23:41:35 +00:00
|
|
|
|
#[test]
|
|
|
|
|
fn test_log_warn_path_might_be_revset() {
|
|
|
|
|
let test_env = TestEnvironment::default();
|
2024-05-17 19:49:25 +00:00
|
|
|
|
test_env.jj_cmd_ok(test_env.env_root(), &["git", "init", "repo"]);
|
2022-11-18 23:41:35 +00:00
|
|
|
|
let repo_path = test_env.env_root().join("repo");
|
|
|
|
|
|
|
|
|
|
std::fs::write(repo_path.join("file1"), "foo\n").unwrap();
|
|
|
|
|
|
|
|
|
|
// Don't warn if the file actually exists.
|
2023-07-03 10:04:31 +00:00
|
|
|
|
let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["log", "file1", "-T", "description"]);
|
|
|
|
|
insta::assert_snapshot!(stdout, @r###"
|
2023-02-09 02:53:47 +00:00
|
|
|
|
@
|
|
|
|
|
│
|
|
|
|
|
~
|
2022-11-18 23:41:35 +00:00
|
|
|
|
"###);
|
2023-07-03 10:04:31 +00:00
|
|
|
|
insta::assert_snapshot!(stderr, @"");
|
2022-11-18 23:41:35 +00:00
|
|
|
|
|
|
|
|
|
// Warn for `jj log .` specifically, for former Mercurial users.
|
2023-07-03 10:04:31 +00:00
|
|
|
|
let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["log", ".", "-T", "description"]);
|
|
|
|
|
insta::assert_snapshot!(stdout, @r###"
|
2023-02-09 02:53:47 +00:00
|
|
|
|
@
|
|
|
|
|
│
|
|
|
|
|
~
|
2022-11-18 23:41:35 +00:00
|
|
|
|
"###);
|
2023-07-03 10:04:31 +00:00
|
|
|
|
insta::assert_snapshot!(stderr, @r###"
|
2024-03-24 06:24:32 +00:00
|
|
|
|
Warning: The argument "." is being interpreted as a path, but this is often not useful because all non-empty commits touch '.'. If you meant to show the working copy commit, pass -r '@' instead.
|
2023-07-03 10:04:31 +00:00
|
|
|
|
"###);
|
2022-11-18 23:41:35 +00:00
|
|
|
|
|
|
|
|
|
// ...but checking `jj log .` makes sense in a subdirectory.
|
|
|
|
|
let subdir = repo_path.join("dir");
|
|
|
|
|
std::fs::create_dir_all(&subdir).unwrap();
|
2023-07-03 10:04:31 +00:00
|
|
|
|
let (stdout, stderr) = test_env.jj_cmd_ok(&subdir, &["log", "."]);
|
|
|
|
|
insta::assert_snapshot!(stdout, @"");
|
|
|
|
|
insta::assert_snapshot!(stderr, @"");
|
2022-11-18 23:41:35 +00:00
|
|
|
|
|
|
|
|
|
// Warn for `jj log @` instead of `jj log -r @`.
|
2023-07-03 10:04:31 +00:00
|
|
|
|
let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["log", "@", "-T", "description"]);
|
|
|
|
|
insta::assert_snapshot!(stdout, @"");
|
|
|
|
|
insta::assert_snapshot!(stderr, @r###"
|
2024-03-24 06:24:32 +00:00
|
|
|
|
Warning: The argument "@" is being interpreted as a path. To specify a revset, pass -r "@" instead.
|
2022-11-18 23:41:35 +00:00
|
|
|
|
"###);
|
|
|
|
|
|
|
|
|
|
// Warn when there's no path with the provided name.
|
2023-07-03 10:04:31 +00:00
|
|
|
|
let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["log", "file2", "-T", "description"]);
|
|
|
|
|
insta::assert_snapshot!(stdout, @"");
|
|
|
|
|
insta::assert_snapshot!(stderr, @r###"
|
2024-03-24 06:24:32 +00:00
|
|
|
|
Warning: The argument "file2" is being interpreted as a path. To specify a revset, pass -r "file2" instead.
|
2022-11-18 23:41:35 +00:00
|
|
|
|
"###);
|
|
|
|
|
|
|
|
|
|
// If an explicit revision is provided, then suppress the warning.
|
2023-07-03 10:04:31 +00:00
|
|
|
|
let (stdout, stderr) =
|
|
|
|
|
test_env.jj_cmd_ok(&repo_path, &["log", "@", "-r", "@", "-T", "description"]);
|
|
|
|
|
insta::assert_snapshot!(stdout, @"");
|
|
|
|
|
insta::assert_snapshot!(stderr, @r###"
|
2022-11-18 23:41:35 +00:00
|
|
|
|
"###);
|
|
|
|
|
}
|
|
|
|
|
|
2022-10-01 15:09:32 +00:00
|
|
|
|
#[test]
|
|
|
|
|
fn test_default_revset() {
|
|
|
|
|
let test_env = TestEnvironment::default();
|
2024-05-17 19:49:25 +00:00
|
|
|
|
test_env.jj_cmd_ok(test_env.env_root(), &["git", "init", "repo"]);
|
2022-10-01 15:09:32 +00:00
|
|
|
|
let repo_path = test_env.env_root().join("repo");
|
|
|
|
|
|
|
|
|
|
std::fs::write(repo_path.join("file1"), "foo\n").unwrap();
|
2023-10-10 11:59:18 +00:00
|
|
|
|
test_env.jj_cmd_ok(&repo_path, &["describe", "-m", "add a file"]);
|
2022-10-01 15:09:32 +00:00
|
|
|
|
|
|
|
|
|
// Set configuration to only show the root commit.
|
2023-09-03 03:47:23 +00:00
|
|
|
|
test_env.add_config(r#"revsets.log = "root()""#);
|
2022-10-01 15:09:32 +00:00
|
|
|
|
|
|
|
|
|
// Log should only contain one line (for the root commit), and not show the
|
|
|
|
|
// commit created above.
|
|
|
|
|
assert_eq!(
|
|
|
|
|
1,
|
|
|
|
|
test_env
|
|
|
|
|
.jj_cmd_success(&repo_path, &["log", "-T", "commit_id"])
|
|
|
|
|
.lines()
|
|
|
|
|
.count()
|
|
|
|
|
);
|
2024-03-31 09:47:31 +00:00
|
|
|
|
|
|
|
|
|
// The default revset is not used if a path is specified
|
|
|
|
|
insta::assert_snapshot!(
|
|
|
|
|
test_env.jj_cmd_success(&repo_path, &["log", "file1", "-T", "description"]),
|
|
|
|
|
@r###"
|
|
|
|
|
@ add a file
|
|
|
|
|
│
|
|
|
|
|
~
|
|
|
|
|
"###);
|
2022-10-01 15:09:32 +00:00
|
|
|
|
}
|
2022-11-26 01:33:24 +00:00
|
|
|
|
|
2023-01-02 05:18:38 +00:00
|
|
|
|
#[test]
|
|
|
|
|
fn test_default_revset_per_repo() {
|
|
|
|
|
let test_env = TestEnvironment::default();
|
2024-05-17 19:49:25 +00:00
|
|
|
|
test_env.jj_cmd_ok(test_env.env_root(), &["git", "init", "repo"]);
|
2023-01-02 05:18:38 +00:00
|
|
|
|
let repo_path = test_env.env_root().join("repo");
|
|
|
|
|
|
|
|
|
|
std::fs::write(repo_path.join("file1"), "foo\n").unwrap();
|
2023-10-10 11:59:18 +00:00
|
|
|
|
test_env.jj_cmd_ok(&repo_path, &["describe", "-m", "add a file"]);
|
2023-01-02 05:18:38 +00:00
|
|
|
|
|
|
|
|
|
// Set configuration to only show the root commit.
|
|
|
|
|
std::fs::write(
|
|
|
|
|
repo_path.join(".jj/repo/config.toml"),
|
2023-09-03 03:47:23 +00:00
|
|
|
|
r#"revsets.log = "root()""#,
|
2023-01-02 05:18:38 +00:00
|
|
|
|
)
|
|
|
|
|
.unwrap();
|
|
|
|
|
|
|
|
|
|
// Log should only contain one line (for the root commit), and not show the
|
|
|
|
|
// commit created above.
|
|
|
|
|
assert_eq!(
|
|
|
|
|
1,
|
|
|
|
|
test_env
|
|
|
|
|
.jj_cmd_success(&repo_path, &["log", "-T", "commit_id"])
|
|
|
|
|
.lines()
|
|
|
|
|
.count()
|
|
|
|
|
);
|
|
|
|
|
}
|
2023-01-13 07:55:52 +00:00
|
|
|
|
|
2023-06-29 08:33:57 +00:00
|
|
|
|
#[test]
|
|
|
|
|
fn test_multiple_revsets() {
|
|
|
|
|
let test_env = TestEnvironment::default();
|
2024-05-17 19:49:25 +00:00
|
|
|
|
test_env.jj_cmd_ok(test_env.env_root(), &["git", "init", "repo"]);
|
2023-06-29 08:33:57 +00:00
|
|
|
|
let repo_path = test_env.env_root().join("repo");
|
|
|
|
|
for name in ["foo", "bar", "baz"] {
|
2023-10-10 11:59:18 +00:00
|
|
|
|
test_env.jj_cmd_ok(&repo_path, &["new", "-m", name]);
|
2024-08-21 19:59:15 +00:00
|
|
|
|
test_env.jj_cmd_ok(&repo_path, &["bookmark", "create", name]);
|
2023-06-29 08:33:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Default revset should be overridden if one or more -r options are specified.
|
2023-09-03 03:47:23 +00:00
|
|
|
|
test_env.add_config(r#"revsets.log = "root()""#);
|
2023-06-29 08:33:57 +00:00
|
|
|
|
|
|
|
|
|
insta::assert_snapshot!(
|
2024-08-21 19:59:15 +00:00
|
|
|
|
test_env.jj_cmd_success(&repo_path, &["log", "-T", "bookmarks", "-rfoo"]),
|
2023-06-29 08:33:57 +00:00
|
|
|
|
@r###"
|
2024-07-15 22:20:10 +00:00
|
|
|
|
○ foo
|
2023-06-29 08:33:57 +00:00
|
|
|
|
│
|
|
|
|
|
~
|
|
|
|
|
"###);
|
|
|
|
|
insta::assert_snapshot!(
|
2024-08-21 19:59:15 +00:00
|
|
|
|
test_env.jj_cmd_success(&repo_path, &["log", "-T", "bookmarks", "-rfoo", "-rbar", "-rbaz"]),
|
2023-06-29 08:33:57 +00:00
|
|
|
|
@r###"
|
|
|
|
|
@ baz
|
2024-07-15 22:20:10 +00:00
|
|
|
|
○ bar
|
|
|
|
|
○ foo
|
2023-06-29 08:33:57 +00:00
|
|
|
|
│
|
|
|
|
|
~
|
|
|
|
|
"###);
|
|
|
|
|
insta::assert_snapshot!(
|
2024-08-21 19:59:15 +00:00
|
|
|
|
test_env.jj_cmd_success(&repo_path, &["log", "-T", "bookmarks", "-rfoo", "-rfoo"]),
|
2023-06-29 08:33:57 +00:00
|
|
|
|
@r###"
|
2024-07-15 22:20:10 +00:00
|
|
|
|
○ foo
|
2023-06-29 08:33:57 +00:00
|
|
|
|
│
|
|
|
|
|
~
|
|
|
|
|
"###);
|
|
|
|
|
}
|
|
|
|
|
|
2023-01-13 07:55:52 +00:00
|
|
|
|
#[test]
|
|
|
|
|
fn test_graph_template_color() {
|
|
|
|
|
// Test that color codes from a multi-line template don't span the graph lines.
|
|
|
|
|
let test_env = TestEnvironment::default();
|
2024-05-17 19:49:25 +00:00
|
|
|
|
test_env.jj_cmd_ok(test_env.env_root(), &["git", "init", "repo"]);
|
2023-01-13 07:55:52 +00:00
|
|
|
|
let repo_path = test_env.env_root().join("repo");
|
|
|
|
|
|
2023-10-10 11:59:18 +00:00
|
|
|
|
test_env.jj_cmd_ok(
|
2023-01-13 07:55:52 +00:00
|
|
|
|
&repo_path,
|
|
|
|
|
&["describe", "-m", "first line\nsecond line\nthird line"],
|
|
|
|
|
);
|
2023-10-10 11:59:18 +00:00
|
|
|
|
test_env.jj_cmd_ok(&repo_path, &["new", "-m", "single line"]);
|
2023-01-13 07:55:52 +00:00
|
|
|
|
|
|
|
|
|
test_env.add_config(
|
2023-01-26 19:26:18 +00:00
|
|
|
|
r#"[colors]
|
2023-01-13 07:55:52 +00:00
|
|
|
|
description = "red"
|
|
|
|
|
"working_copy description" = "green"
|
|
|
|
|
"#,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
// First test without color for comparison
|
2023-02-03 03:49:40 +00:00
|
|
|
|
let template = r#"label(if(current_working_copy, "working_copy"), description)"#;
|
|
|
|
|
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-T", template]);
|
2023-01-13 07:55:52 +00:00
|
|
|
|
insta::assert_snapshot!(stdout, @r###"
|
2023-02-09 02:53:47 +00:00
|
|
|
|
@ single line
|
2024-07-15 22:20:10 +00:00
|
|
|
|
○ first line
|
2023-02-09 02:53:47 +00:00
|
|
|
|
│ second line
|
|
|
|
|
│ third line
|
2024-07-15 22:20:10 +00:00
|
|
|
|
◆
|
2023-01-13 07:55:52 +00:00
|
|
|
|
"###);
|
2023-02-03 03:49:40 +00:00
|
|
|
|
let stdout = test_env.jj_cmd_success(&repo_path, &["--color=always", "log", "-T", template]);
|
2023-01-13 07:55:52 +00:00
|
|
|
|
insta::assert_snapshot!(stdout, @r###"
|
2024-07-15 22:20:10 +00:00
|
|
|
|
[1m[38;5;2m@[0m [1m[38;5;2msingle line[0m
|
|
|
|
|
○ [38;5;1mfirst line[39m
|
2023-02-09 02:53:47 +00:00
|
|
|
|
│ [38;5;1msecond line[39m
|
|
|
|
|
│ [38;5;1mthird line[39m
|
2024-07-15 22:20:10 +00:00
|
|
|
|
[1m[38;5;14m◆[0m
|
2023-01-13 07:55:52 +00:00
|
|
|
|
"###);
|
2024-05-06 16:23:36 +00:00
|
|
|
|
let stdout = test_env.jj_cmd_success(&repo_path, &["--color=debug", "log", "-T", template]);
|
|
|
|
|
insta::assert_snapshot!(stdout, @r###"
|
2024-07-15 22:20:10 +00:00
|
|
|
|
[1m[38;5;2m<<node working_copy::@>>[0m [1m[38;5;2m<<log working_copy description::single line>>[0m
|
|
|
|
|
<<node::○>> [38;5;1m<<log description::first line>>[39m
|
2024-05-06 16:23:36 +00:00
|
|
|
|
│ [38;5;1m<<log description::second line>>[39m
|
|
|
|
|
│ [38;5;1m<<log description::third line>>[39m
|
2024-07-15 22:20:10 +00:00
|
|
|
|
[1m[38;5;14m<<node immutable::◆>>[0m
|
2024-05-06 16:23:36 +00:00
|
|
|
|
"###);
|
2023-01-13 07:55:52 +00:00
|
|
|
|
}
|
2023-01-27 06:33:24 +00:00
|
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
|
fn test_graph_styles() {
|
|
|
|
|
// Test that different graph styles are available.
|
|
|
|
|
let test_env = TestEnvironment::default();
|
2024-05-17 19:49:25 +00:00
|
|
|
|
test_env.jj_cmd_ok(test_env.env_root(), &["git", "init", "repo"]);
|
2023-01-27 06:33:24 +00:00
|
|
|
|
let repo_path = test_env.env_root().join("repo");
|
|
|
|
|
|
2023-10-10 11:59:18 +00:00
|
|
|
|
test_env.jj_cmd_ok(&repo_path, &["commit", "-m", "initial"]);
|
2024-08-21 19:59:15 +00:00
|
|
|
|
test_env.jj_cmd_ok(&repo_path, &["commit", "-m", "main bookmark 1"]);
|
|
|
|
|
test_env.jj_cmd_ok(&repo_path, &["describe", "-m", "main bookmark 2"]);
|
2023-10-10 11:59:18 +00:00
|
|
|
|
test_env.jj_cmd_ok(
|
2023-01-27 06:33:24 +00:00
|
|
|
|
&repo_path,
|
2024-08-21 19:59:15 +00:00
|
|
|
|
&["new", "-m", "side bookmark\nwith\nlong\ndescription"],
|
2023-01-27 06:33:24 +00:00
|
|
|
|
);
|
2023-10-10 11:59:18 +00:00
|
|
|
|
test_env.jj_cmd_ok(
|
2023-01-27 06:33:24 +00:00
|
|
|
|
&repo_path,
|
2024-08-21 19:59:15 +00:00
|
|
|
|
&[
|
|
|
|
|
"new",
|
|
|
|
|
"-m",
|
|
|
|
|
"merge",
|
|
|
|
|
r#"description("main bookmark 1")"#,
|
|
|
|
|
"@",
|
|
|
|
|
],
|
2023-01-27 06:33:24 +00:00
|
|
|
|
);
|
|
|
|
|
|
2024-02-11 18:41:41 +00:00
|
|
|
|
// Default (curved) style
|
2023-01-27 06:33:24 +00:00
|
|
|
|
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-T=description"]);
|
|
|
|
|
insta::assert_snapshot!(stdout, @r###"
|
2023-02-09 02:53:47 +00:00
|
|
|
|
@ merge
|
|
|
|
|
├─╮
|
2024-08-21 19:59:15 +00:00
|
|
|
|
│ ○ side bookmark
|
2023-02-09 02:53:47 +00:00
|
|
|
|
│ │ with
|
|
|
|
|
│ │ long
|
|
|
|
|
│ │ description
|
2024-08-21 19:59:15 +00:00
|
|
|
|
│ ○ main bookmark 2
|
2023-02-09 02:53:47 +00:00
|
|
|
|
├─╯
|
2024-08-21 19:59:15 +00:00
|
|
|
|
○ main bookmark 1
|
2024-07-15 22:20:10 +00:00
|
|
|
|
○ initial
|
|
|
|
|
◆
|
2023-01-27 06:33:24 +00:00
|
|
|
|
"###);
|
|
|
|
|
|
|
|
|
|
// ASCII style
|
2023-01-27 18:15:51 +00:00
|
|
|
|
test_env.add_config(r#"ui.graph.style = "ascii""#);
|
2023-01-27 06:33:24 +00:00
|
|
|
|
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-T=description"]);
|
|
|
|
|
insta::assert_snapshot!(stdout, @r###"
|
|
|
|
|
@ merge
|
|
|
|
|
|\
|
2024-08-21 19:59:15 +00:00
|
|
|
|
| o side bookmark
|
2023-01-27 06:33:24 +00:00
|
|
|
|
| | with
|
|
|
|
|
| | long
|
|
|
|
|
| | description
|
2024-08-21 19:59:15 +00:00
|
|
|
|
| o main bookmark 2
|
2023-01-27 06:33:24 +00:00
|
|
|
|
|/
|
2024-08-21 19:59:15 +00:00
|
|
|
|
o main bookmark 1
|
2023-01-27 06:33:24 +00:00
|
|
|
|
o initial
|
2024-07-15 22:20:10 +00:00
|
|
|
|
+
|
2023-01-27 06:33:24 +00:00
|
|
|
|
"###);
|
|
|
|
|
|
|
|
|
|
// Large ASCII style
|
2023-01-27 18:15:51 +00:00
|
|
|
|
test_env.add_config(r#"ui.graph.style = "ascii-large""#);
|
2023-01-27 06:33:24 +00:00
|
|
|
|
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-T=description"]);
|
|
|
|
|
insta::assert_snapshot!(stdout, @r###"
|
|
|
|
|
@ merge
|
|
|
|
|
|\
|
|
|
|
|
| \
|
2024-08-21 19:59:15 +00:00
|
|
|
|
| o side bookmark
|
2023-01-27 06:33:24 +00:00
|
|
|
|
| | with
|
|
|
|
|
| | long
|
|
|
|
|
| | description
|
2024-08-21 19:59:15 +00:00
|
|
|
|
| o main bookmark 2
|
2023-01-27 06:33:24 +00:00
|
|
|
|
| /
|
|
|
|
|
|/
|
2024-08-21 19:59:15 +00:00
|
|
|
|
o main bookmark 1
|
2023-01-27 06:33:24 +00:00
|
|
|
|
o initial
|
2024-07-15 22:20:10 +00:00
|
|
|
|
+
|
2023-01-27 06:33:24 +00:00
|
|
|
|
"###);
|
|
|
|
|
|
|
|
|
|
// Curved style
|
2023-01-27 18:15:51 +00:00
|
|
|
|
test_env.add_config(r#"ui.graph.style = "curved""#);
|
2023-01-27 06:33:24 +00:00
|
|
|
|
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-T=description"]);
|
|
|
|
|
insta::assert_snapshot!(stdout, @r###"
|
|
|
|
|
@ merge
|
|
|
|
|
├─╮
|
2024-08-21 19:59:15 +00:00
|
|
|
|
│ ○ side bookmark
|
2023-01-27 06:33:24 +00:00
|
|
|
|
│ │ with
|
|
|
|
|
│ │ long
|
|
|
|
|
│ │ description
|
2024-08-21 19:59:15 +00:00
|
|
|
|
│ ○ main bookmark 2
|
2023-01-27 06:33:24 +00:00
|
|
|
|
├─╯
|
2024-08-21 19:59:15 +00:00
|
|
|
|
○ main bookmark 1
|
2024-07-15 22:20:10 +00:00
|
|
|
|
○ initial
|
|
|
|
|
◆
|
2023-01-27 06:33:24 +00:00
|
|
|
|
"###);
|
|
|
|
|
|
|
|
|
|
// Square style
|
2023-01-27 18:15:51 +00:00
|
|
|
|
test_env.add_config(r#"ui.graph.style = "square""#);
|
2023-01-27 06:33:24 +00:00
|
|
|
|
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-T=description"]);
|
|
|
|
|
insta::assert_snapshot!(stdout, @r###"
|
|
|
|
|
@ merge
|
|
|
|
|
├─┐
|
2024-08-21 19:59:15 +00:00
|
|
|
|
│ ○ side bookmark
|
2023-01-27 06:33:24 +00:00
|
|
|
|
│ │ with
|
|
|
|
|
│ │ long
|
|
|
|
|
│ │ description
|
2024-08-21 19:59:15 +00:00
|
|
|
|
│ ○ main bookmark 2
|
2023-01-27 06:33:24 +00:00
|
|
|
|
├─┘
|
2024-08-21 19:59:15 +00:00
|
|
|
|
○ main bookmark 1
|
2024-07-15 22:20:10 +00:00
|
|
|
|
○ initial
|
|
|
|
|
◆
|
2023-01-27 06:33:24 +00:00
|
|
|
|
"###);
|
2024-09-03 08:01:22 +00:00
|
|
|
|
|
|
|
|
|
// Invalid style name
|
|
|
|
|
let stderr = test_env.jj_cmd_failure(
|
|
|
|
|
&repo_path,
|
|
|
|
|
&["log", "--config-toml=ui.graph.style='unknown'"],
|
|
|
|
|
);
|
|
|
|
|
insta::assert_snapshot!(stderr, @r###"
|
|
|
|
|
Config error: enum GraphStyle does not have variant constructor unknown
|
|
|
|
|
For help, see https://martinvonz.github.io/jj/latest/config/.
|
|
|
|
|
"###);
|
2023-01-27 06:33:24 +00:00
|
|
|
|
}
|
2023-03-05 04:10:02 +00:00
|
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
|
fn test_log_word_wrap() {
|
|
|
|
|
let test_env = TestEnvironment::default();
|
2024-05-17 19:49:25 +00:00
|
|
|
|
test_env.jj_cmd_ok(test_env.env_root(), &["git", "init", "repo"]);
|
2023-03-05 04:10:02 +00:00
|
|
|
|
let repo_path = test_env.env_root().join("repo");
|
|
|
|
|
let render = |args: &[&str], columns: u32, word_wrap: bool| {
|
|
|
|
|
let mut args = args.to_vec();
|
|
|
|
|
if word_wrap {
|
|
|
|
|
args.push("--config-toml=ui.log-word-wrap=true");
|
|
|
|
|
}
|
|
|
|
|
let assert = test_env
|
|
|
|
|
.jj_cmd(&repo_path, &args)
|
|
|
|
|
.env("COLUMNS", columns.to_string())
|
|
|
|
|
.assert()
|
|
|
|
|
.success()
|
|
|
|
|
.stderr("");
|
|
|
|
|
get_stdout_string(&assert)
|
|
|
|
|
};
|
|
|
|
|
|
2024-08-21 19:59:15 +00:00
|
|
|
|
test_env.jj_cmd_ok(&repo_path, &["commit", "-m", "main bookmark 1"]);
|
|
|
|
|
test_env.jj_cmd_ok(&repo_path, &["describe", "-m", "main bookmark 2"]);
|
2023-10-10 11:59:18 +00:00
|
|
|
|
test_env.jj_cmd_ok(&repo_path, &["new", "-m", "side"]);
|
|
|
|
|
test_env.jj_cmd_ok(&repo_path, &["new", "-m", "merge", "@--", "@"]);
|
2023-03-05 04:10:02 +00:00
|
|
|
|
|
|
|
|
|
// ui.log-word-wrap option applies to both graph/no-graph outputs
|
|
|
|
|
insta::assert_snapshot!(render(&["log", "-r@"], 40, false), @r###"
|
2024-08-21 19:59:15 +00:00
|
|
|
|
@ mzvwutvl test.user@example.com 2001-02-03 08:05:11 f3efbd00
|
2023-03-05 04:10:02 +00:00
|
|
|
|
│ (empty) merge
|
|
|
|
|
~
|
|
|
|
|
"###);
|
|
|
|
|
insta::assert_snapshot!(render(&["log", "-r@"], 40, true), @r###"
|
2023-07-30 05:24:34 +00:00
|
|
|
|
@ mzvwutvl test.user@example.com
|
2024-08-21 19:59:15 +00:00
|
|
|
|
│ 2001-02-03 08:05:11 f3efbd00
|
2024-02-12 07:26:19 +00:00
|
|
|
|
~ (empty) merge
|
2023-03-05 04:10:02 +00:00
|
|
|
|
"###);
|
|
|
|
|
insta::assert_snapshot!(render(&["log", "--no-graph", "-r@"], 40, false), @r###"
|
2024-08-21 19:59:15 +00:00
|
|
|
|
mzvwutvl test.user@example.com 2001-02-03 08:05:11 f3efbd00
|
2023-03-05 04:10:02 +00:00
|
|
|
|
(empty) merge
|
|
|
|
|
"###);
|
|
|
|
|
insta::assert_snapshot!(render(&["log", "--no-graph", "-r@"], 40, true), @r###"
|
2023-07-30 05:24:34 +00:00
|
|
|
|
mzvwutvl test.user@example.com
|
2024-08-21 19:59:15 +00:00
|
|
|
|
2001-02-03 08:05:11 f3efbd00
|
2023-03-05 04:10:02 +00:00
|
|
|
|
(empty) merge
|
|
|
|
|
"###);
|
|
|
|
|
|
|
|
|
|
// Color labels should be preserved
|
|
|
|
|
insta::assert_snapshot!(render(&["log", "-r@", "--color=always"], 40, true), @r###"
|
2024-07-15 22:20:10 +00:00
|
|
|
|
[1m[38;5;2m@[0m [1m[38;5;13mm[38;5;8mzvwutvl[39m [38;5;3mtest.user@example.com[39m[0m
|
2024-08-21 19:59:15 +00:00
|
|
|
|
│ [1m[38;5;14m2001-02-03 08:05:11[39m [38;5;12mf[38;5;8m3efbd00[39m[0m
|
2024-02-12 07:26:19 +00:00
|
|
|
|
~ [1m[38;5;10m(empty)[39m merge[0m
|
2023-03-05 04:10:02 +00:00
|
|
|
|
"###);
|
|
|
|
|
|
|
|
|
|
// Graph width should be subtracted from the term width
|
|
|
|
|
let template = r#""0 1 2 3 4 5 6 7 8 9""#;
|
|
|
|
|
insta::assert_snapshot!(render(&["log", "-T", template], 10, true), @r###"
|
|
|
|
|
@ 0 1 2
|
|
|
|
|
├─╮ 3 4 5
|
|
|
|
|
│ │ 6 7 8
|
|
|
|
|
│ │ 9
|
2024-07-15 22:20:10 +00:00
|
|
|
|
│ ○ 0 1 2
|
2023-03-05 04:10:02 +00:00
|
|
|
|
│ │ 3 4 5
|
|
|
|
|
│ │ 6 7 8
|
|
|
|
|
│ │ 9
|
2024-07-15 22:20:10 +00:00
|
|
|
|
│ ○ 0 1 2
|
2023-03-05 04:10:02 +00:00
|
|
|
|
├─╯ 3 4 5
|
|
|
|
|
│ 6 7 8
|
|
|
|
|
│ 9
|
2024-07-15 22:20:10 +00:00
|
|
|
|
○ 0 1 2 3
|
2023-03-05 04:10:02 +00:00
|
|
|
|
│ 4 5 6 7
|
|
|
|
|
│ 8 9
|
2024-07-15 22:20:10 +00:00
|
|
|
|
◆ 0 1 2 3
|
2023-03-05 04:10:02 +00:00
|
|
|
|
4 5 6 7
|
|
|
|
|
8 9
|
|
|
|
|
"###);
|
|
|
|
|
|
|
|
|
|
// Shouldn't panic with $COLUMNS < graph_width
|
|
|
|
|
insta::assert_snapshot!(render(&["log", "-r@"], 0, true), @r###"
|
2023-07-30 05:24:34 +00:00
|
|
|
|
@ mzvwutvl
|
2023-03-05 04:10:02 +00:00
|
|
|
|
│ test.user@example.com
|
|
|
|
|
~ 2001-02-03
|
2024-02-12 07:26:19 +00:00
|
|
|
|
08:05:11
|
2024-08-21 19:59:15 +00:00
|
|
|
|
f3efbd00
|
2023-03-05 04:10:02 +00:00
|
|
|
|
(empty)
|
|
|
|
|
merge
|
|
|
|
|
"###);
|
|
|
|
|
insta::assert_snapshot!(render(&["log", "-r@"], 1, true), @r###"
|
2023-07-30 05:24:34 +00:00
|
|
|
|
@ mzvwutvl
|
2023-03-05 04:10:02 +00:00
|
|
|
|
│ test.user@example.com
|
|
|
|
|
~ 2001-02-03
|
2024-02-12 07:26:19 +00:00
|
|
|
|
08:05:11
|
2024-08-21 19:59:15 +00:00
|
|
|
|
f3efbd00
|
2023-03-05 04:10:02 +00:00
|
|
|
|
(empty)
|
|
|
|
|
merge
|
|
|
|
|
"###);
|
|
|
|
|
}
|
2024-02-11 18:09:31 +00:00
|
|
|
|
|
2024-07-29 13:13:02 +00:00
|
|
|
|
#[test]
|
|
|
|
|
fn test_log_diff_stat_width() {
|
|
|
|
|
let test_env = TestEnvironment::default();
|
|
|
|
|
test_env.jj_cmd_ok(test_env.env_root(), &["git", "init", "repo"]);
|
|
|
|
|
let repo_path = test_env.env_root().join("repo");
|
|
|
|
|
let render = |args: &[&str], columns: u32| {
|
|
|
|
|
let assert = test_env
|
|
|
|
|
.jj_cmd(&repo_path, args)
|
|
|
|
|
.env("COLUMNS", columns.to_string())
|
|
|
|
|
.assert()
|
|
|
|
|
.success()
|
|
|
|
|
.stderr("");
|
|
|
|
|
get_stdout_string(&assert)
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
std::fs::write(repo_path.join("file1"), "foo\n".repeat(100)).unwrap();
|
|
|
|
|
test_env.jj_cmd_ok(&repo_path, &["new", "root()"]);
|
|
|
|
|
std::fs::write(repo_path.join("file2"), "foo\n".repeat(100)).unwrap();
|
|
|
|
|
|
|
|
|
|
insta::assert_snapshot!(render(&["log", "--stat", "--no-graph"], 30), @r###"
|
|
|
|
|
rlvkpnrz test.user@example.com 2001-02-03 08:05:09 287520bf
|
|
|
|
|
(no description set)
|
|
|
|
|
file2 | 100 +++++++++++++++
|
|
|
|
|
1 file changed, 100 insertions(+), 0 deletions(-)
|
|
|
|
|
qpvuntsm test.user@example.com 2001-02-03 08:05:08 e292def1
|
|
|
|
|
(no description set)
|
|
|
|
|
file1 | 100 +++++++++++++++
|
|
|
|
|
1 file changed, 100 insertions(+), 0 deletions(-)
|
|
|
|
|
zzzzzzzz root() 00000000
|
|
|
|
|
0 files changed, 0 insertions(+), 0 deletions(-)
|
|
|
|
|
"###);
|
|
|
|
|
|
|
|
|
|
// Graph width should be subtracted
|
|
|
|
|
insta::assert_snapshot!(render(&["log", "--stat"], 30), @r###"
|
|
|
|
|
@ rlvkpnrz test.user@example.com 2001-02-03 08:05:09 287520bf
|
|
|
|
|
│ (no description set)
|
|
|
|
|
│ file2 | 100 ++++++++++++
|
|
|
|
|
│ 1 file changed, 100 insertions(+), 0 deletions(-)
|
|
|
|
|
│ ○ qpvuntsm test.user@example.com 2001-02-03 08:05:08 e292def1
|
|
|
|
|
├─╯ (no description set)
|
|
|
|
|
│ file1 | 100 ++++++++++
|
|
|
|
|
│ 1 file changed, 100 insertions(+), 0 deletions(-)
|
|
|
|
|
◆ zzzzzzzz root() 00000000
|
|
|
|
|
0 files changed, 0 insertions(+), 0 deletions(-)
|
|
|
|
|
"###);
|
|
|
|
|
}
|
|
|
|
|
|
2024-02-11 18:09:31 +00:00
|
|
|
|
#[test]
|
|
|
|
|
fn test_elided() {
|
|
|
|
|
// Test that elided commits are shown as synthetic nodes.
|
|
|
|
|
let test_env = TestEnvironment::default();
|
2024-05-17 19:49:25 +00:00
|
|
|
|
test_env.jj_cmd_ok(test_env.env_root(), &["git", "init", "repo"]);
|
2024-02-11 18:09:31 +00:00
|
|
|
|
let repo_path = test_env.env_root().join("repo");
|
|
|
|
|
|
|
|
|
|
test_env.jj_cmd_ok(&repo_path, &["describe", "-m", "initial"]);
|
2024-08-21 19:59:15 +00:00
|
|
|
|
test_env.jj_cmd_ok(&repo_path, &["new", "-m", "main bookmark 1"]);
|
|
|
|
|
test_env.jj_cmd_ok(&repo_path, &["new", "-m", "main bookmark 2"]);
|
|
|
|
|
test_env.jj_cmd_ok(&repo_path, &["new", "@--", "-m", "side bookmark 1"]);
|
|
|
|
|
test_env.jj_cmd_ok(&repo_path, &["new", "-m", "side bookmark 2"]);
|
2024-02-11 18:09:31 +00:00
|
|
|
|
test_env.jj_cmd_ok(
|
|
|
|
|
&repo_path,
|
2024-08-21 19:59:15 +00:00
|
|
|
|
&[
|
|
|
|
|
"new",
|
|
|
|
|
"-m",
|
|
|
|
|
"merge",
|
|
|
|
|
r#"description("main bookmark 2")"#,
|
|
|
|
|
"@",
|
|
|
|
|
],
|
2024-02-11 18:09:31 +00:00
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
let get_log = |revs: &str| -> String {
|
|
|
|
|
test_env.jj_cmd_success(
|
|
|
|
|
&repo_path,
|
|
|
|
|
&["log", "-T", r#"description ++ "\n""#, "-r", revs],
|
|
|
|
|
)
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// Test the setup
|
|
|
|
|
insta::assert_snapshot!(get_log("::"), @r###"
|
|
|
|
|
@ merge
|
|
|
|
|
├─╮
|
2024-08-21 19:59:15 +00:00
|
|
|
|
│ ○ side bookmark 2
|
2024-02-11 18:09:31 +00:00
|
|
|
|
│ │
|
2024-08-21 19:59:15 +00:00
|
|
|
|
│ ○ side bookmark 1
|
2024-02-11 18:09:31 +00:00
|
|
|
|
│ │
|
2024-08-21 19:59:15 +00:00
|
|
|
|
○ │ main bookmark 2
|
2024-02-11 18:09:31 +00:00
|
|
|
|
│ │
|
2024-08-21 19:59:15 +00:00
|
|
|
|
○ │ main bookmark 1
|
2024-02-11 18:09:31 +00:00
|
|
|
|
├─╯
|
2024-07-15 22:20:10 +00:00
|
|
|
|
○ initial
|
2024-02-11 18:09:31 +00:00
|
|
|
|
│
|
2024-07-15 22:20:10 +00:00
|
|
|
|
◆
|
2024-02-11 18:09:31 +00:00
|
|
|
|
"###);
|
|
|
|
|
|
|
|
|
|
// Elide some commits from each side of the merge. It's unclear that a revision
|
|
|
|
|
// was skipped on the left side.
|
2024-03-08 17:43:24 +00:00
|
|
|
|
test_env.add_config("ui.log-synthetic-elided-nodes = false");
|
2024-02-11 18:09:31 +00:00
|
|
|
|
insta::assert_snapshot!(get_log("@ | @- | description(initial)"), @r###"
|
|
|
|
|
@ merge
|
|
|
|
|
├─╮
|
2024-08-21 19:59:15 +00:00
|
|
|
|
│ ○ side bookmark 2
|
2024-02-11 18:09:31 +00:00
|
|
|
|
│ ╷
|
2024-08-21 19:59:15 +00:00
|
|
|
|
○ ╷ main bookmark 2
|
2024-02-11 18:09:31 +00:00
|
|
|
|
├─╯
|
2024-07-15 22:20:10 +00:00
|
|
|
|
○ initial
|
2024-02-11 18:09:31 +00:00
|
|
|
|
│
|
|
|
|
|
~
|
|
|
|
|
"###);
|
|
|
|
|
|
|
|
|
|
// Elide shared commits. It's unclear that a revision was skipped on the right
|
|
|
|
|
// side (#1252).
|
|
|
|
|
insta::assert_snapshot!(get_log("@-- | root()"), @r###"
|
2024-08-21 19:59:15 +00:00
|
|
|
|
○ side bookmark 1
|
2024-02-11 18:09:31 +00:00
|
|
|
|
╷
|
2024-08-21 19:59:15 +00:00
|
|
|
|
╷ ○ main bookmark 1
|
2024-02-11 18:09:31 +00:00
|
|
|
|
╭─╯
|
2024-07-15 22:20:10 +00:00
|
|
|
|
◆
|
2024-02-11 18:09:31 +00:00
|
|
|
|
"###);
|
|
|
|
|
|
|
|
|
|
// Now test the same thing with synthetic nodes for elided commits
|
|
|
|
|
|
|
|
|
|
// Elide some commits from each side of the merge
|
|
|
|
|
test_env.add_config("ui.log-synthetic-elided-nodes = true");
|
|
|
|
|
insta::assert_snapshot!(get_log("@ | @- | description(initial)"), @r###"
|
|
|
|
|
@ merge
|
|
|
|
|
├─╮
|
2024-08-21 19:59:15 +00:00
|
|
|
|
│ ○ side bookmark 2
|
2024-02-11 18:09:31 +00:00
|
|
|
|
│ │
|
2024-07-15 22:20:10 +00:00
|
|
|
|
│ ~ (elided revisions)
|
2024-08-21 19:59:15 +00:00
|
|
|
|
○ │ main bookmark 2
|
2024-02-11 18:09:31 +00:00
|
|
|
|
│ │
|
2024-07-15 22:20:10 +00:00
|
|
|
|
~ │ (elided revisions)
|
2024-02-11 18:09:31 +00:00
|
|
|
|
├─╯
|
2024-07-15 22:20:10 +00:00
|
|
|
|
○ initial
|
2024-02-11 18:09:31 +00:00
|
|
|
|
│
|
|
|
|
|
~
|
|
|
|
|
"###);
|
|
|
|
|
|
|
|
|
|
// Elide shared commits. To keep the implementation simple, it still gets
|
|
|
|
|
// rendered as two synthetic nodes.
|
|
|
|
|
insta::assert_snapshot!(get_log("@-- | root()"), @r###"
|
2024-08-21 19:59:15 +00:00
|
|
|
|
○ side bookmark 1
|
2024-02-11 18:09:31 +00:00
|
|
|
|
│
|
2024-07-15 22:20:10 +00:00
|
|
|
|
~ (elided revisions)
|
2024-08-21 19:59:15 +00:00
|
|
|
|
│ ○ main bookmark 1
|
2024-02-11 18:09:31 +00:00
|
|
|
|
│ │
|
2024-07-15 22:20:10 +00:00
|
|
|
|
│ ~ (elided revisions)
|
2024-02-11 18:09:31 +00:00
|
|
|
|
├─╯
|
2024-07-15 22:20:10 +00:00
|
|
|
|
◆
|
2024-02-11 18:09:31 +00:00
|
|
|
|
"###);
|
|
|
|
|
}
|
2024-03-06 22:46:02 +00:00
|
|
|
|
|
|
|
|
|
#[test]
|
2024-03-11 22:16:24 +00:00
|
|
|
|
fn test_log_with_custom_symbols() {
|
2024-03-06 22:46:02 +00:00
|
|
|
|
// Test that elided commits are shown as synthetic nodes.
|
|
|
|
|
let test_env = TestEnvironment::default();
|
2024-05-17 19:49:25 +00:00
|
|
|
|
test_env.jj_cmd_ok(test_env.env_root(), &["git", "init", "repo"]);
|
2024-03-06 22:46:02 +00:00
|
|
|
|
let repo_path = test_env.env_root().join("repo");
|
|
|
|
|
|
|
|
|
|
test_env.jj_cmd_ok(&repo_path, &["describe", "-m", "initial"]);
|
2024-08-21 19:59:15 +00:00
|
|
|
|
test_env.jj_cmd_ok(&repo_path, &["new", "-m", "main bookmark 1"]);
|
|
|
|
|
test_env.jj_cmd_ok(&repo_path, &["new", "-m", "main bookmark 2"]);
|
|
|
|
|
test_env.jj_cmd_ok(&repo_path, &["new", "@--", "-m", "side bookmark 1"]);
|
|
|
|
|
test_env.jj_cmd_ok(&repo_path, &["new", "-m", "side bookmark 2"]);
|
2024-03-06 22:46:02 +00:00
|
|
|
|
test_env.jj_cmd_ok(
|
|
|
|
|
&repo_path,
|
2024-08-21 19:59:15 +00:00
|
|
|
|
&[
|
|
|
|
|
"new",
|
|
|
|
|
"-m",
|
|
|
|
|
"merge",
|
|
|
|
|
r#"description("main bookmark 2")"#,
|
|
|
|
|
"@",
|
|
|
|
|
],
|
2024-03-06 22:46:02 +00:00
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
let get_log = |revs: &str| -> String {
|
|
|
|
|
test_env.jj_cmd_success(
|
|
|
|
|
&repo_path,
|
|
|
|
|
&["log", "-T", r#"description ++ "\n""#, "-r", revs],
|
|
|
|
|
)
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// Simple test with showing default and elided nodes.
|
2024-03-18 12:52:25 +00:00
|
|
|
|
test_env.add_config(
|
|
|
|
|
r###"
|
|
|
|
|
ui.log-synthetic-elided-nodes = true
|
|
|
|
|
templates.log_node = 'if(self, if(current_working_copy, "$", if(root, "┴", "┝")), "🮀")'
|
|
|
|
|
"###,
|
|
|
|
|
);
|
2024-03-11 22:16:24 +00:00
|
|
|
|
insta::assert_snapshot!(get_log("@ | @- | description(initial) | root()"), @r###"
|
|
|
|
|
$ merge
|
2024-03-06 22:46:02 +00:00
|
|
|
|
├─╮
|
2024-08-21 19:59:15 +00:00
|
|
|
|
│ ┝ side bookmark 2
|
2024-03-06 22:46:02 +00:00
|
|
|
|
│ │
|
|
|
|
|
│ 🮀 (elided revisions)
|
2024-08-21 19:59:15 +00:00
|
|
|
|
┝ │ main bookmark 2
|
2024-03-06 22:46:02 +00:00
|
|
|
|
│ │
|
|
|
|
|
🮀 │ (elided revisions)
|
|
|
|
|
├─╯
|
|
|
|
|
┝ initial
|
|
|
|
|
│
|
2024-03-11 22:16:24 +00:00
|
|
|
|
┴
|
2024-03-06 22:46:02 +00:00
|
|
|
|
"###);
|
|
|
|
|
|
|
|
|
|
// Simple test with showing default and elided nodes, ascii style.
|
2024-03-18 12:52:25 +00:00
|
|
|
|
test_env.add_config(
|
|
|
|
|
r###"
|
|
|
|
|
ui.log-synthetic-elided-nodes = true
|
|
|
|
|
ui.graph.style = 'ascii'
|
|
|
|
|
templates.log_node = 'if(self, if(current_working_copy, "$", if(root, "^", "*")), ":")'
|
|
|
|
|
"###,
|
|
|
|
|
);
|
2024-03-11 22:16:24 +00:00
|
|
|
|
insta::assert_snapshot!(get_log("@ | @- | description(initial) | root()"), @r###"
|
|
|
|
|
$ merge
|
2024-03-06 22:46:02 +00:00
|
|
|
|
|\
|
2024-08-21 19:59:15 +00:00
|
|
|
|
| * side bookmark 2
|
2024-03-06 22:46:02 +00:00
|
|
|
|
| |
|
|
|
|
|
| : (elided revisions)
|
2024-08-21 19:59:15 +00:00
|
|
|
|
* | main bookmark 2
|
2024-03-06 22:46:02 +00:00
|
|
|
|
| |
|
|
|
|
|
: | (elided revisions)
|
|
|
|
|
|/
|
|
|
|
|
* initial
|
|
|
|
|
|
|
2024-03-11 22:16:24 +00:00
|
|
|
|
^
|
2024-03-06 22:46:02 +00:00
|
|
|
|
"###);
|
|
|
|
|
}
|