2022-11-26 23:57:50 +00:00
|
|
|
|
// Copyright 2022 The Jujutsu Authors
|
2022-06-03 22:25:56 +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.
|
2023-03-05 04:10:02 +00:00
|
|
|
|
|
2024-02-02 07:55:24 +00:00
|
|
|
|
use crate::common::{get_stdout_string, TestEnvironment};
|
2022-06-03 22:25:56 +00:00
|
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
|
fn test_obslog_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-06-03 22:25:56 +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, &["new", "-m", "my description"]);
|
2022-06-03 22:25:56 +00:00
|
|
|
|
std::fs::write(repo_path.join("file1"), "foo\nbar\n").unwrap();
|
|
|
|
|
std::fs::write(repo_path.join("file2"), "foo\n").unwrap();
|
2023-10-10 11:59:18 +00:00
|
|
|
|
test_env.jj_cmd_ok(&repo_path, &["rebase", "-r", "@", "-d", "root()"]);
|
2022-06-03 22:25:56 +00:00
|
|
|
|
std::fs::write(repo_path.join("file1"), "resolved\n").unwrap();
|
|
|
|
|
|
2023-01-26 05:42:13 +00:00
|
|
|
|
let stdout = test_env.jj_cmd_success(&repo_path, &["obslog"]);
|
2022-06-03 22:25:56 +00:00
|
|
|
|
insta::assert_snapshot!(stdout, @r###"
|
2024-02-12 07:26:19 +00:00
|
|
|
|
@ rlvkpnrz test.user@example.com 2001-02-03 08:05:10 66b42ad3
|
2023-02-09 02:53:47 +00:00
|
|
|
|
│ my description
|
2024-04-21 19:37:19 +00:00
|
|
|
|
◉ rlvkpnrz hidden test.user@example.com 2001-02-03 08:05:09 cf73917d conflict
|
2023-02-09 02:53:47 +00:00
|
|
|
|
│ my description
|
2024-06-23 22:20:33 +00:00
|
|
|
|
◉ rlvkpnrz hidden test.user@example.com 2001-02-03 08:05:09 068224a7
|
2023-02-09 02:53:47 +00:00
|
|
|
|
│ my description
|
2024-06-23 22:20:33 +00:00
|
|
|
|
◉ rlvkpnrz hidden test.user@example.com 2001-02-03 08:05:08 2b023b5f
|
2023-02-09 02:53:47 +00:00
|
|
|
|
(empty) my description
|
2022-06-03 22:25:56 +00:00
|
|
|
|
"###);
|
|
|
|
|
|
2023-04-08 01:28:16 +00:00
|
|
|
|
// Color
|
|
|
|
|
let stdout = test_env.jj_cmd_success(&repo_path, &["--color=always", "obslog"]);
|
|
|
|
|
insta::assert_snapshot!(stdout, @r###"
|
2024-02-12 07:26:19 +00:00
|
|
|
|
@ [1m[38;5;13mr[38;5;8mlvkpnrz[39m [38;5;3mtest.user@example.com[39m [38;5;14m2001-02-03 08:05:10[39m [38;5;12m6[38;5;8m6b42ad3[39m[0m
|
2023-04-08 01:28:16 +00:00
|
|
|
|
│ [1mmy description[0m
|
2024-04-21 19:37:19 +00:00
|
|
|
|
◉ [1m[39mr[0m[38;5;8mlvkpnrz[39m hidden [38;5;3mtest.user@example.com[39m [38;5;6m2001-02-03 08:05:09[39m [1m[38;5;4mc[0m[38;5;8mf73917d[39m [38;5;1mconflict[39m
|
2023-04-08 01:28:16 +00:00
|
|
|
|
│ my description
|
2024-06-23 22:20:33 +00:00
|
|
|
|
◉ [1m[39mr[0m[38;5;8mlvkpnrz[39m hidden [38;5;3mtest.user@example.com[39m [38;5;6m2001-02-03 08:05:09[39m [1m[38;5;4m06[0m[38;5;8m8224a7[39m
|
2023-04-08 01:28:16 +00:00
|
|
|
|
│ my description
|
2024-06-23 22:20:33 +00:00
|
|
|
|
◉ [1m[39mr[0m[38;5;8mlvkpnrz[39m hidden [38;5;3mtest.user@example.com[39m [38;5;6m2001-02-03 08:05:08[39m [1m[38;5;4m2b[0m[38;5;8m023b5f[39m
|
2023-04-08 01:28:16 +00:00
|
|
|
|
[38;5;2m(empty)[39m my description
|
|
|
|
|
"###);
|
|
|
|
|
|
2022-06-03 22:25:56 +00:00
|
|
|
|
// There should be no diff caused by the rebase because it was a pure rebase
|
|
|
|
|
// (even even though it resulted in a conflict).
|
2023-01-26 05:42:13 +00:00
|
|
|
|
let stdout = test_env.jj_cmd_success(&repo_path, &["obslog", "-p"]);
|
2022-06-03 22:25:56 +00:00
|
|
|
|
insta::assert_snapshot!(stdout, @r###"
|
2024-02-12 07:26:19 +00:00
|
|
|
|
@ rlvkpnrz test.user@example.com 2001-02-03 08:05:10 66b42ad3
|
2023-02-09 02:53:47 +00:00
|
|
|
|
│ my description
|
|
|
|
|
│ Resolved conflict in file1:
|
conflicts.rs: label conflict number and sides next to conflict markers
For example,
```
<<<<<<< Conflict 1 of 3
+++++++ Contents of side #1
left 3.1
left 3.2
left 3.3
%%%%%%% Changes from base to side #2
-line 3
+right 3.1
>>>>>>>
```
or
```
<<<<<<< Conflict 1 of 1
%%%%%%% Changes from base to side #1
-line 3
+right 3.1
+++++++ Contents of side #2
left 3.1
left 3.2
left 3.3
>>>>>>>
```
Currently, there is no way to disable these, this is TODO for a future
PR. Other TODOs for future PRs: make these labels configurable. After
that, we could support a `diff3/git`-like conflict format as well, in
principle.
Counting conflicts helps with knowing whether you fixed all the
conflicts while you are in the editor.
While labeling "side #1", etc, does not tell you the commit id or
description as requested in #1176, I still think it's an improvement.
Most importantly, I hope this will make `jj`'s conflict format less
scary-looking for new users.
I've used this for a bit, and I like it. Without the labels, I would see
that the two conflicts have a different order of conflict markers, but I
wouldn't be able to remember what that means. For longer diffs, it can
be tricky for me to quickly tell that it's a diff as opposed to one of
the sides. This also creates some hope of being able to navigate a
conflict with more than 2 sides.
Another not-so-secret goal for this is explained in
https://github.com/martinvonz/jj/pull/3109#issuecomment-2014140627. The
idea is a little weird, but I *think* it could be helpful, and I'd like
to experiment with it.
2024-03-23 22:16:28 +00:00
|
|
|
|
│ 1 1: <<<<<<< Conflict 1 of 1resolved
|
|
|
|
|
│ 2 : %%%%%%% Changes from base to side #1
|
2023-10-05 04:30:29 +00:00
|
|
|
|
│ 3 : -foo
|
conflicts.rs: label conflict number and sides next to conflict markers
For example,
```
<<<<<<< Conflict 1 of 3
+++++++ Contents of side #1
left 3.1
left 3.2
left 3.3
%%%%%%% Changes from base to side #2
-line 3
+right 3.1
>>>>>>>
```
or
```
<<<<<<< Conflict 1 of 1
%%%%%%% Changes from base to side #1
-line 3
+right 3.1
+++++++ Contents of side #2
left 3.1
left 3.2
left 3.3
>>>>>>>
```
Currently, there is no way to disable these, this is TODO for a future
PR. Other TODOs for future PRs: make these labels configurable. After
that, we could support a `diff3/git`-like conflict format as well, in
principle.
Counting conflicts helps with knowing whether you fixed all the
conflicts while you are in the editor.
While labeling "side #1", etc, does not tell you the commit id or
description as requested in #1176, I still think it's an improvement.
Most importantly, I hope this will make `jj`'s conflict format less
scary-looking for new users.
I've used this for a bit, and I like it. Without the labels, I would see
that the two conflicts have a different order of conflict markers, but I
wouldn't be able to remember what that means. For longer diffs, it can
be tricky for me to quickly tell that it's a diff as opposed to one of
the sides. This also creates some hope of being able to navigate a
conflict with more than 2 sides.
Another not-so-secret goal for this is explained in
https://github.com/martinvonz/jj/pull/3109#issuecomment-2014140627. The
idea is a little weird, but I *think* it could be helpful, and I'd like
to experiment with it.
2024-03-23 22:16:28 +00:00
|
|
|
|
│ 4 : +++++++ Contents of side #2
|
2023-10-05 04:30:29 +00:00
|
|
|
|
│ 5 : foo
|
|
|
|
|
│ 6 : bar
|
2024-05-16 01:00:50 +00:00
|
|
|
|
│ 7 : >>>>>>> Conflict 1 of 1 ends
|
2024-04-21 19:37:19 +00:00
|
|
|
|
◉ rlvkpnrz hidden test.user@example.com 2001-02-03 08:05:09 cf73917d conflict
|
2023-02-09 02:53:47 +00:00
|
|
|
|
│ my description
|
2024-06-23 22:20:33 +00:00
|
|
|
|
◉ rlvkpnrz hidden test.user@example.com 2001-02-03 08:05:09 068224a7
|
2023-02-09 02:53:47 +00:00
|
|
|
|
│ my description
|
|
|
|
|
│ Modified regular file file1:
|
|
|
|
|
│ 1 1: foo
|
|
|
|
|
│ 2: bar
|
|
|
|
|
│ Added regular file file2:
|
|
|
|
|
│ 1: foo
|
2024-06-23 22:20:33 +00:00
|
|
|
|
◉ rlvkpnrz hidden test.user@example.com 2001-02-03 08:05:08 2b023b5f
|
2023-02-09 02:53:47 +00:00
|
|
|
|
(empty) my description
|
2022-06-03 22:25:56 +00:00
|
|
|
|
"###);
|
|
|
|
|
|
2023-08-10 09:14:54 +00:00
|
|
|
|
// Test `--limit`
|
|
|
|
|
let stdout = test_env.jj_cmd_success(&repo_path, &["obslog", "--limit=2"]);
|
|
|
|
|
insta::assert_snapshot!(stdout, @r###"
|
2024-02-12 07:26:19 +00:00
|
|
|
|
@ rlvkpnrz test.user@example.com 2001-02-03 08:05:10 66b42ad3
|
2023-08-10 09:14:54 +00:00
|
|
|
|
│ my description
|
2024-04-21 19:37:19 +00:00
|
|
|
|
◉ rlvkpnrz hidden test.user@example.com 2001-02-03 08:05:09 cf73917d conflict
|
2023-08-10 09:14:54 +00:00
|
|
|
|
│ my description
|
|
|
|
|
"###);
|
|
|
|
|
|
2022-06-03 22:25:56 +00:00
|
|
|
|
// Test `--no-graph`
|
2023-01-26 05:42:13 +00:00
|
|
|
|
let stdout = test_env.jj_cmd_success(&repo_path, &["obslog", "--no-graph"]);
|
2022-06-03 22:25:56 +00:00
|
|
|
|
insta::assert_snapshot!(stdout, @r###"
|
2024-02-12 07:26:19 +00:00
|
|
|
|
rlvkpnrz test.user@example.com 2001-02-03 08:05:10 66b42ad3
|
2022-06-03 22:25:56 +00:00
|
|
|
|
my description
|
2024-04-21 19:37:19 +00:00
|
|
|
|
rlvkpnrz hidden test.user@example.com 2001-02-03 08:05:09 cf73917d conflict
|
2022-06-03 22:25:56 +00:00
|
|
|
|
my description
|
2024-06-23 22:20:33 +00:00
|
|
|
|
rlvkpnrz hidden test.user@example.com 2001-02-03 08:05:09 068224a7
|
2022-06-03 22:25:56 +00:00
|
|
|
|
my description
|
2024-06-23 22:20:33 +00:00
|
|
|
|
rlvkpnrz hidden test.user@example.com 2001-02-03 08:05:08 2b023b5f
|
2023-01-14 10:43:23 +00:00
|
|
|
|
(empty) my description
|
2022-06-03 22:25:56 +00:00
|
|
|
|
"###);
|
|
|
|
|
|
|
|
|
|
// Test `--git` format, and that it implies `-p`
|
2023-01-26 05:42:13 +00:00
|
|
|
|
let stdout = test_env.jj_cmd_success(&repo_path, &["obslog", "--no-graph", "--git"]);
|
2022-06-03 22:25:56 +00:00
|
|
|
|
insta::assert_snapshot!(stdout, @r###"
|
2024-02-12 07:26:19 +00:00
|
|
|
|
rlvkpnrz test.user@example.com 2001-02-03 08:05:10 66b42ad3
|
2022-06-03 22:25:56 +00:00
|
|
|
|
my description
|
|
|
|
|
diff --git a/file1 b/file1
|
2023-08-26 20:19:31 +00:00
|
|
|
|
index 0000000000...2ab19ae607 100644
|
2022-06-03 22:25:56 +00:00
|
|
|
|
--- a/file1
|
|
|
|
|
+++ b/file1
|
2023-10-05 04:30:29 +00:00
|
|
|
|
@@ -1,7 +1,1 @@
|
conflicts.rs: label conflict number and sides next to conflict markers
For example,
```
<<<<<<< Conflict 1 of 3
+++++++ Contents of side #1
left 3.1
left 3.2
left 3.3
%%%%%%% Changes from base to side #2
-line 3
+right 3.1
>>>>>>>
```
or
```
<<<<<<< Conflict 1 of 1
%%%%%%% Changes from base to side #1
-line 3
+right 3.1
+++++++ Contents of side #2
left 3.1
left 3.2
left 3.3
>>>>>>>
```
Currently, there is no way to disable these, this is TODO for a future
PR. Other TODOs for future PRs: make these labels configurable. After
that, we could support a `diff3/git`-like conflict format as well, in
principle.
Counting conflicts helps with knowing whether you fixed all the
conflicts while you are in the editor.
While labeling "side #1", etc, does not tell you the commit id or
description as requested in #1176, I still think it's an improvement.
Most importantly, I hope this will make `jj`'s conflict format less
scary-looking for new users.
I've used this for a bit, and I like it. Without the labels, I would see
that the two conflicts have a different order of conflict markers, but I
wouldn't be able to remember what that means. For longer diffs, it can
be tricky for me to quickly tell that it's a diff as opposed to one of
the sides. This also creates some hope of being able to navigate a
conflict with more than 2 sides.
Another not-so-secret goal for this is explained in
https://github.com/martinvonz/jj/pull/3109#issuecomment-2014140627. The
idea is a little weird, but I *think* it could be helpful, and I'd like
to experiment with it.
2024-03-23 22:16:28 +00:00
|
|
|
|
-<<<<<<< Conflict 1 of 1
|
|
|
|
|
-%%%%%%% Changes from base to side #1
|
2023-10-05 04:30:29 +00:00
|
|
|
|
--foo
|
conflicts.rs: label conflict number and sides next to conflict markers
For example,
```
<<<<<<< Conflict 1 of 3
+++++++ Contents of side #1
left 3.1
left 3.2
left 3.3
%%%%%%% Changes from base to side #2
-line 3
+right 3.1
>>>>>>>
```
or
```
<<<<<<< Conflict 1 of 1
%%%%%%% Changes from base to side #1
-line 3
+right 3.1
+++++++ Contents of side #2
left 3.1
left 3.2
left 3.3
>>>>>>>
```
Currently, there is no way to disable these, this is TODO for a future
PR. Other TODOs for future PRs: make these labels configurable. After
that, we could support a `diff3/git`-like conflict format as well, in
principle.
Counting conflicts helps with knowing whether you fixed all the
conflicts while you are in the editor.
While labeling "side #1", etc, does not tell you the commit id or
description as requested in #1176, I still think it's an improvement.
Most importantly, I hope this will make `jj`'s conflict format less
scary-looking for new users.
I've used this for a bit, and I like it. Without the labels, I would see
that the two conflicts have a different order of conflict markers, but I
wouldn't be able to remember what that means. For longer diffs, it can
be tricky for me to quickly tell that it's a diff as opposed to one of
the sides. This also creates some hope of being able to navigate a
conflict with more than 2 sides.
Another not-so-secret goal for this is explained in
https://github.com/martinvonz/jj/pull/3109#issuecomment-2014140627. The
idea is a little weird, but I *think* it could be helpful, and I'd like
to experiment with it.
2024-03-23 22:16:28 +00:00
|
|
|
|
-+++++++ Contents of side #2
|
2023-10-05 04:30:29 +00:00
|
|
|
|
-foo
|
|
|
|
|
-bar
|
2024-05-16 01:00:50 +00:00
|
|
|
|
->>>>>>> Conflict 1 of 1 ends
|
2022-06-03 22:25:56 +00:00
|
|
|
|
+resolved
|
2024-04-21 19:37:19 +00:00
|
|
|
|
rlvkpnrz hidden test.user@example.com 2001-02-03 08:05:09 cf73917d conflict
|
2022-06-03 22:25:56 +00:00
|
|
|
|
my description
|
2024-06-23 22:20:33 +00:00
|
|
|
|
rlvkpnrz hidden test.user@example.com 2001-02-03 08:05:09 068224a7
|
2022-06-03 22:25:56 +00:00
|
|
|
|
my description
|
|
|
|
|
diff --git a/file1 b/file1
|
|
|
|
|
index 257cc5642c...3bd1f0e297 100644
|
|
|
|
|
--- a/file1
|
|
|
|
|
+++ b/file1
|
|
|
|
|
@@ -1,1 +1,2 @@
|
|
|
|
|
foo
|
|
|
|
|
+bar
|
|
|
|
|
diff --git a/file2 b/file2
|
|
|
|
|
new file mode 100644
|
|
|
|
|
index 0000000000..257cc5642c
|
|
|
|
|
--- /dev/null
|
|
|
|
|
+++ b/file2
|
|
|
|
|
@@ -1,0 +1,1 @@
|
|
|
|
|
+foo
|
2024-06-23 22:20:33 +00:00
|
|
|
|
rlvkpnrz hidden test.user@example.com 2001-02-03 08:05:08 2b023b5f
|
2023-01-14 10:43:23 +00:00
|
|
|
|
(empty) my description
|
2022-06-03 22:25:56 +00:00
|
|
|
|
"###);
|
|
|
|
|
}
|
|
|
|
|
|
2024-03-11 22:16:24 +00:00
|
|
|
|
#[test]
|
|
|
|
|
fn test_obslog_with_custom_symbols() {
|
|
|
|
|
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-11 22:16:24 +00:00
|
|
|
|
let repo_path = test_env.env_root().join("repo");
|
|
|
|
|
|
|
|
|
|
std::fs::write(repo_path.join("file1"), "foo\n").unwrap();
|
|
|
|
|
test_env.jj_cmd_ok(&repo_path, &["new", "-m", "my description"]);
|
|
|
|
|
std::fs::write(repo_path.join("file1"), "foo\nbar\n").unwrap();
|
|
|
|
|
std::fs::write(repo_path.join("file2"), "foo\n").unwrap();
|
|
|
|
|
test_env.jj_cmd_ok(&repo_path, &["rebase", "-r", "@", "-d", "root()"]);
|
|
|
|
|
std::fs::write(repo_path.join("file1"), "resolved\n").unwrap();
|
|
|
|
|
|
|
|
|
|
let toml = concat!("templates.log_node = 'if(current_working_copy, \"$\", \"┝\")'\n",);
|
|
|
|
|
|
|
|
|
|
let stdout = test_env.jj_cmd_success(&repo_path, &["obslog", "--config-toml", toml]);
|
|
|
|
|
|
|
|
|
|
insta::assert_snapshot!(stdout, @r###"
|
|
|
|
|
$ rlvkpnrz test.user@example.com 2001-02-03 08:05:10 66b42ad3
|
|
|
|
|
│ my description
|
2024-04-21 19:37:19 +00:00
|
|
|
|
┝ rlvkpnrz hidden test.user@example.com 2001-02-03 08:05:09 cf73917d conflict
|
2024-03-11 22:16:24 +00:00
|
|
|
|
│ my description
|
2024-06-23 22:20:33 +00:00
|
|
|
|
┝ rlvkpnrz hidden test.user@example.com 2001-02-03 08:05:09 068224a7
|
2024-03-11 22:16:24 +00:00
|
|
|
|
│ my description
|
2024-06-23 22:20:33 +00:00
|
|
|
|
┝ rlvkpnrz hidden test.user@example.com 2001-02-03 08:05:08 2b023b5f
|
2024-03-11 22:16:24 +00:00
|
|
|
|
(empty) my description
|
|
|
|
|
"###);
|
|
|
|
|
}
|
|
|
|
|
|
2023-03-05 04:10:02 +00:00
|
|
|
|
#[test]
|
|
|
|
|
fn test_obslog_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)
|
|
|
|
|
};
|
|
|
|
|
|
2023-10-10 11:59:18 +00:00
|
|
|
|
test_env.jj_cmd_ok(&repo_path, &["describe", "-m", "first"]);
|
2023-03-05 04:10:02 +00:00
|
|
|
|
|
|
|
|
|
// ui.log-word-wrap option applies to both graph/no-graph outputs
|
|
|
|
|
insta::assert_snapshot!(render(&["obslog"], 40, false), @r###"
|
2024-06-23 22:20:33 +00:00
|
|
|
|
@ qpvuntsm test.user@example.com 2001-02-03 08:05:08 fa15625b
|
2023-03-05 04:10:02 +00:00
|
|
|
|
│ (empty) first
|
2024-02-12 07:26:19 +00:00
|
|
|
|
◉ qpvuntsm hidden test.user@example.com 2001-02-03 08:05:07 230dd059
|
2023-03-05 04:10:02 +00:00
|
|
|
|
(empty) (no description set)
|
|
|
|
|
"###);
|
|
|
|
|
insta::assert_snapshot!(render(&["obslog"], 40, true), @r###"
|
2023-07-30 05:24:34 +00:00
|
|
|
|
@ qpvuntsm test.user@example.com
|
2024-06-23 22:20:33 +00:00
|
|
|
|
│ 2001-02-03 08:05:08 fa15625b
|
2023-03-05 04:10:02 +00:00
|
|
|
|
│ (empty) first
|
2023-07-30 05:24:34 +00:00
|
|
|
|
◉ qpvuntsm hidden test.user@example.com
|
2024-02-12 07:26:19 +00:00
|
|
|
|
2001-02-03 08:05:07 230dd059
|
2023-03-05 04:10:02 +00:00
|
|
|
|
(empty) (no description set)
|
|
|
|
|
"###);
|
|
|
|
|
insta::assert_snapshot!(render(&["obslog", "--no-graph"], 40, false), @r###"
|
2024-06-23 22:20:33 +00:00
|
|
|
|
qpvuntsm test.user@example.com 2001-02-03 08:05:08 fa15625b
|
2023-03-05 04:10:02 +00:00
|
|
|
|
(empty) first
|
2024-02-12 07:26:19 +00:00
|
|
|
|
qpvuntsm hidden test.user@example.com 2001-02-03 08:05:07 230dd059
|
2023-03-05 04:10:02 +00:00
|
|
|
|
(empty) (no description set)
|
|
|
|
|
"###);
|
|
|
|
|
insta::assert_snapshot!(render(&["obslog", "--no-graph"], 40, true), @r###"
|
2023-07-30 05:24:34 +00:00
|
|
|
|
qpvuntsm test.user@example.com
|
2024-06-23 22:20:33 +00:00
|
|
|
|
2001-02-03 08:05:08 fa15625b
|
2023-03-05 04:10:02 +00:00
|
|
|
|
(empty) first
|
2023-07-30 05:24:34 +00:00
|
|
|
|
qpvuntsm hidden test.user@example.com
|
2024-02-12 07:26:19 +00:00
|
|
|
|
2001-02-03 08:05:07 230dd059
|
2023-03-05 04:10:02 +00:00
|
|
|
|
(empty) (no description set)
|
|
|
|
|
"###);
|
|
|
|
|
}
|
|
|
|
|
|
2022-06-03 22:25:56 +00:00
|
|
|
|
#[test]
|
|
|
|
|
fn test_obslog_squash() {
|
2022-08-28 17:28:53 +00:00
|
|
|
|
let mut 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-06-03 22:25:56 +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"]);
|
2022-06-03 22:25:56 +00:00
|
|
|
|
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, &["new", "-m", "second"]);
|
2022-06-03 22:25:56 +00:00
|
|
|
|
std::fs::write(repo_path.join("file1"), "foo\nbar\n").unwrap();
|
2022-08-28 17:28:53 +00:00
|
|
|
|
|
|
|
|
|
let edit_script = test_env.set_up_fake_editor();
|
2022-11-04 04:14:41 +00:00
|
|
|
|
std::fs::write(edit_script, "write\nsquashed").unwrap();
|
2023-10-10 11:59:18 +00:00
|
|
|
|
test_env.jj_cmd_ok(&repo_path, &["squash"]);
|
2022-06-03 22:25:56 +00:00
|
|
|
|
|
2023-01-26 05:42:13 +00:00
|
|
|
|
let stdout = test_env.jj_cmd_success(&repo_path, &["obslog", "-p", "-r", "@-"]);
|
2022-06-03 22:25:56 +00:00
|
|
|
|
insta::assert_snapshot!(stdout, @r###"
|
2024-06-23 22:20:33 +00:00
|
|
|
|
◉ qpvuntsm test.user@example.com 2001-02-03 08:05:10 68647e34
|
2023-02-09 02:53:47 +00:00
|
|
|
|
├─╮ squashed
|
|
|
|
|
│ │ Modified regular file file1:
|
|
|
|
|
│ │ 1 1: foo
|
|
|
|
|
│ │ 2: bar
|
2024-06-23 22:20:33 +00:00
|
|
|
|
◉ │ qpvuntsm hidden test.user@example.com 2001-02-03 08:05:09 766420db
|
2023-02-09 02:53:47 +00:00
|
|
|
|
│ │ first
|
|
|
|
|
│ │ Added regular file file1:
|
|
|
|
|
│ │ 1: foo
|
2024-06-23 22:20:33 +00:00
|
|
|
|
◉ │ qpvuntsm hidden test.user@example.com 2001-02-03 08:05:08 fa15625b
|
2023-02-09 02:53:47 +00:00
|
|
|
|
│ │ (empty) first
|
2024-02-12 07:26:19 +00:00
|
|
|
|
◉ │ qpvuntsm hidden test.user@example.com 2001-02-03 08:05:07 230dd059
|
2023-02-09 02:53:47 +00:00
|
|
|
|
│ (empty) (no description set)
|
2024-06-23 22:20:33 +00:00
|
|
|
|
◉ kkmpptxz hidden test.user@example.com 2001-02-03 08:05:10 46acd22a
|
2023-02-09 02:53:47 +00:00
|
|
|
|
│ second
|
|
|
|
|
│ Modified regular file file1:
|
|
|
|
|
│ 1 1: foo
|
|
|
|
|
│ 2: bar
|
2024-06-23 22:20:33 +00:00
|
|
|
|
◉ kkmpptxz hidden test.user@example.com 2001-02-03 08:05:09 cba41deb
|
2023-02-09 02:53:47 +00:00
|
|
|
|
(empty) second
|
2022-06-03 22:25:56 +00:00
|
|
|
|
"###);
|
|
|
|
|
}
|
2024-03-03 06:04:59 +00:00
|
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
|
fn test_obslog_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, &["obslog", "-T"]);
|
|
|
|
|
insta::assert_snapshot!(stderr, @r###"
|
|
|
|
|
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
|
|
|
|
|
"###);
|
|
|
|
|
}
|