mirror of
https://github.com/martinvonz/jj.git
synced 2025-01-26 22:10:52 +00:00
test_resolve_command: use diff --git
for readability
This commit is contained in:
parent
f43a810fe0
commit
2f48f76e85
1 changed files with 132 additions and 84 deletions
|
@ -97,16 +97,21 @@ fn test_resolution() {
|
||||||
insta::assert_snapshot!(
|
insta::assert_snapshot!(
|
||||||
std::fs::read_to_string(test_env.env_root().join("editor0")).unwrap(), @r###"
|
std::fs::read_to_string(test_env.env_root().join("editor0")).unwrap(), @r###"
|
||||||
"###);
|
"###);
|
||||||
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["diff"]),
|
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["diff", "--git"]),
|
||||||
@r###"
|
@r###"
|
||||||
Resolved conflict in file:
|
diff --git a/file b/file
|
||||||
1 1: <<<<<<<resolution
|
index 0000000000...88425ec521 100644
|
||||||
2 : %%%%%%%
|
--- a/file
|
||||||
3 : -base
|
+++ b/file
|
||||||
4 : +a
|
@@ -1,7 +1,1 @@
|
||||||
5 : +++++++
|
-<<<<<<<
|
||||||
6 : b
|
-%%%%%%%
|
||||||
7 : >>>>>>>
|
--base
|
||||||
|
-+a
|
||||||
|
-+++++++
|
||||||
|
-b
|
||||||
|
->>>>>>>
|
||||||
|
+resolution
|
||||||
"###);
|
"###);
|
||||||
insta::assert_snapshot!(test_env.jj_cmd_cli_error(&repo_path, &["resolve", "--list"]),
|
insta::assert_snapshot!(test_env.jj_cmd_cli_error(&repo_path, &["resolve", "--list"]),
|
||||||
@r###"
|
@r###"
|
||||||
|
@ -132,16 +137,21 @@ fn test_resolution() {
|
||||||
Parent commit : royxmykx db6a4daf b | b
|
Parent commit : royxmykx db6a4daf b | b
|
||||||
Added 0 files, modified 1 files, removed 0 files
|
Added 0 files, modified 1 files, removed 0 files
|
||||||
"###);
|
"###);
|
||||||
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["diff"]),
|
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["diff", "--git"]),
|
||||||
@r###"
|
@r###"
|
||||||
Resolved conflict in file:
|
diff --git a/file b/file
|
||||||
1 1: <<<<<<<resolution
|
index 0000000000...88425ec521 100644
|
||||||
2 : %%%%%%%
|
--- a/file
|
||||||
3 : -base
|
+++ b/file
|
||||||
4 : +a
|
@@ -1,7 +1,1 @@
|
||||||
5 : +++++++
|
-<<<<<<<
|
||||||
6 : b
|
-%%%%%%%
|
||||||
7 : >>>>>>>
|
--base
|
||||||
|
-+a
|
||||||
|
-+++++++
|
||||||
|
-b
|
||||||
|
->>>>>>>
|
||||||
|
+resolution
|
||||||
"###);
|
"###);
|
||||||
insta::assert_snapshot!(test_env.jj_cmd_cli_error(&repo_path, &["resolve", "--list"]),
|
insta::assert_snapshot!(test_env.jj_cmd_cli_error(&repo_path, &["resolve", "--list"]),
|
||||||
@r###"
|
@r###"
|
||||||
|
@ -151,7 +161,7 @@ fn test_resolution() {
|
||||||
// Check that the output file starts with conflict markers if
|
// Check that the output file starts with conflict markers if
|
||||||
// `merge-tool-edits-conflict-markers=true`
|
// `merge-tool-edits-conflict-markers=true`
|
||||||
test_env.jj_cmd_ok(&repo_path, &["undo"]);
|
test_env.jj_cmd_ok(&repo_path, &["undo"]);
|
||||||
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["diff"]),
|
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["diff", "--git"]),
|
||||||
@"");
|
@"");
|
||||||
std::fs::write(
|
std::fs::write(
|
||||||
&editor_script,
|
&editor_script,
|
||||||
|
@ -176,22 +186,27 @@ fn test_resolution() {
|
||||||
b
|
b
|
||||||
>>>>>>>
|
>>>>>>>
|
||||||
"###);
|
"###);
|
||||||
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["diff"]),
|
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["diff", "--git"]),
|
||||||
@r###"
|
@r###"
|
||||||
Resolved conflict in file:
|
diff --git a/file b/file
|
||||||
1 1: <<<<<<<resolution
|
index 0000000000...88425ec521 100644
|
||||||
2 : %%%%%%%
|
--- a/file
|
||||||
3 : -base
|
+++ b/file
|
||||||
4 : +a
|
@@ -1,7 +1,1 @@
|
||||||
5 : +++++++
|
-<<<<<<<
|
||||||
6 : b
|
-%%%%%%%
|
||||||
7 : >>>>>>>
|
--base
|
||||||
|
-+a
|
||||||
|
-+++++++
|
||||||
|
-b
|
||||||
|
->>>>>>>
|
||||||
|
+resolution
|
||||||
"###);
|
"###);
|
||||||
|
|
||||||
// Check that if merge tool leaves conflict markers in output file and
|
// Check that if merge tool leaves conflict markers in output file and
|
||||||
// `merge-tool-edits-conflict-markers=true`, these markers are properly parsed.
|
// `merge-tool-edits-conflict-markers=true`, these markers are properly parsed.
|
||||||
test_env.jj_cmd_ok(&repo_path, &["undo"]);
|
test_env.jj_cmd_ok(&repo_path, &["undo"]);
|
||||||
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["diff"]),
|
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["diff", "--git"]),
|
||||||
@"");
|
@"");
|
||||||
std::fs::write(
|
std::fs::write(
|
||||||
&editor_script,
|
&editor_script,
|
||||||
|
@ -247,16 +262,22 @@ fn test_resolution() {
|
||||||
>>>>>>>
|
>>>>>>>
|
||||||
"###);
|
"###);
|
||||||
// Note the "Modified" below
|
// Note the "Modified" below
|
||||||
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["diff"]),
|
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["diff", "--git"]),
|
||||||
@r###"
|
@r###"
|
||||||
Modified conflict in file:
|
diff --git a/file b/file
|
||||||
1 1: <<<<<<<
|
--- a/file
|
||||||
2 2: %%%%%%%
|
+++ b/file
|
||||||
3 3: -basesome
|
@@ -1,7 +1,7 @@
|
||||||
4 4: +afake
|
<<<<<<<
|
||||||
5 5: +++++++
|
%%%%%%%
|
||||||
6 6: bconflict
|
--base
|
||||||
7 7: >>>>>>>
|
-+a
|
||||||
|
+-some
|
||||||
|
++fake
|
||||||
|
+++++++
|
||||||
|
-b
|
||||||
|
+conflict
|
||||||
|
>>>>>>>
|
||||||
"###);
|
"###);
|
||||||
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["resolve", "--list"]),
|
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["resolve", "--list"]),
|
||||||
@r###"
|
@r###"
|
||||||
|
@ -267,7 +288,7 @@ fn test_resolution() {
|
||||||
// `merge-tool-edits-conflict-markers=false` or is not specified,
|
// `merge-tool-edits-conflict-markers=false` or is not specified,
|
||||||
// `jj` considers the conflict resolved.
|
// `jj` considers the conflict resolved.
|
||||||
test_env.jj_cmd_ok(&repo_path, &["undo"]);
|
test_env.jj_cmd_ok(&repo_path, &["undo"]);
|
||||||
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["diff"]),
|
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["diff", "--git"]),
|
||||||
@"");
|
@"");
|
||||||
std::fs::write(
|
std::fs::write(
|
||||||
&editor_script,
|
&editor_script,
|
||||||
|
@ -300,16 +321,23 @@ fn test_resolution() {
|
||||||
std::fs::read_to_string(test_env.env_root().join("editor3")).unwrap(), @r###"
|
std::fs::read_to_string(test_env.env_root().join("editor3")).unwrap(), @r###"
|
||||||
"###);
|
"###);
|
||||||
// Note the "Resolved" below
|
// Note the "Resolved" below
|
||||||
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["diff"]),
|
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["diff", "--git"]),
|
||||||
@r###"
|
@r###"
|
||||||
Resolved conflict in file:
|
diff --git a/file b/file
|
||||||
1 1: <<<<<<<
|
index 0000000000...0610716cc1 100644
|
||||||
2 2: %%%%%%%
|
--- a/file
|
||||||
3 3: -basesome
|
+++ b/file
|
||||||
4 4: +afake
|
@@ -1,7 +1,7 @@
|
||||||
5 5: +++++++
|
<<<<<<<
|
||||||
6 6: bconflict
|
%%%%%%%
|
||||||
7 7: >>>>>>>
|
--base
|
||||||
|
-+a
|
||||||
|
+-some
|
||||||
|
++fake
|
||||||
|
+++++++
|
||||||
|
-b
|
||||||
|
+conflict
|
||||||
|
>>>>>>>
|
||||||
"###);
|
"###);
|
||||||
insta::assert_snapshot!(test_env.jj_cmd_cli_error(&repo_path, &["resolve", "--list"]),
|
insta::assert_snapshot!(test_env.jj_cmd_cli_error(&repo_path, &["resolve", "--list"]),
|
||||||
@r###"
|
@r###"
|
||||||
|
@ -707,16 +735,21 @@ fn test_multiple_conflicts() {
|
||||||
There are unresolved conflicts at these paths:
|
There are unresolved conflicts at these paths:
|
||||||
this_file_has_a_very_long_name_to_test_padding 2-sided conflict
|
this_file_has_a_very_long_name_to_test_padding 2-sided conflict
|
||||||
"###);
|
"###);
|
||||||
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["diff"]),
|
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["diff", "--git"]),
|
||||||
@r###"
|
@r###"
|
||||||
Resolved conflict in another_file:
|
diff --git a/another_file b/another_file
|
||||||
1 : <<<<<<<
|
index 0000000000...a9fcc7d486 100644
|
||||||
2 : %%%%%%%
|
--- a/another_file
|
||||||
3 1: -secondresolution baseanother_file
|
+++ b/another_file
|
||||||
4 : +second a
|
@@ -1,7 +1,1 @@
|
||||||
5 : +++++++
|
-<<<<<<<
|
||||||
6 : second b
|
-%%%%%%%
|
||||||
7 : >>>>>>>
|
--second base
|
||||||
|
-+second a
|
||||||
|
-+++++++
|
||||||
|
-second b
|
||||||
|
->>>>>>>
|
||||||
|
+resolution another_file
|
||||||
"###);
|
"###);
|
||||||
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["resolve", "--list"]),
|
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["resolve", "--list"]),
|
||||||
@r###"
|
@r###"
|
||||||
|
@ -733,7 +766,7 @@ fn test_multiple_conflicts() {
|
||||||
// For the rest of the test, we call `jj resolve` several times in a row to
|
// For the rest of the test, we call `jj resolve` several times in a row to
|
||||||
// resolve each conflict in the order it chooses.
|
// resolve each conflict in the order it chooses.
|
||||||
test_env.jj_cmd_ok(&repo_path, &["undo"]);
|
test_env.jj_cmd_ok(&repo_path, &["undo"]);
|
||||||
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["diff"]),
|
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["diff", "--git"]),
|
||||||
@"");
|
@"");
|
||||||
std::fs::write(
|
std::fs::write(
|
||||||
&editor_script,
|
&editor_script,
|
||||||
|
@ -741,16 +774,21 @@ fn test_multiple_conflicts() {
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
test_env.jj_cmd_ok(&repo_path, &["resolve"]);
|
test_env.jj_cmd_ok(&repo_path, &["resolve"]);
|
||||||
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["diff"]),
|
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["diff", "--git"]),
|
||||||
@r###"
|
@r###"
|
||||||
Resolved conflict in another_file:
|
diff --git a/another_file b/another_file
|
||||||
1 : <<<<<<<
|
index 0000000000...7903e1c1c7 100644
|
||||||
2 : %%%%%%%
|
--- a/another_file
|
||||||
3 1: first resolution for auto-secondchosen basefile
|
+++ b/another_file
|
||||||
4 : +second a
|
@@ -1,7 +1,1 @@
|
||||||
5 : +++++++
|
-<<<<<<<
|
||||||
6 : second b
|
-%%%%%%%
|
||||||
7 : >>>>>>>
|
--second base
|
||||||
|
-+second a
|
||||||
|
-+++++++
|
||||||
|
-second b
|
||||||
|
->>>>>>>
|
||||||
|
+first resolution for auto-chosen file
|
||||||
"###);
|
"###);
|
||||||
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["resolve", "--list"]),
|
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["resolve", "--list"]),
|
||||||
@r###"
|
@r###"
|
||||||
|
@ -763,24 +801,34 @@ fn test_multiple_conflicts() {
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
test_env.jj_cmd_ok(&repo_path, &["resolve"]);
|
test_env.jj_cmd_ok(&repo_path, &["resolve"]);
|
||||||
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["diff"]),
|
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["diff", "--git"]),
|
||||||
@r###"
|
@r###"
|
||||||
Resolved conflict in another_file:
|
diff --git a/another_file b/another_file
|
||||||
1 : <<<<<<<
|
index 0000000000...7903e1c1c7 100644
|
||||||
2 : %%%%%%%
|
--- a/another_file
|
||||||
3 1: first resolution for auto-secondchosen basefile
|
+++ b/another_file
|
||||||
4 : +second a
|
@@ -1,7 +1,1 @@
|
||||||
5 : +++++++
|
-<<<<<<<
|
||||||
6 : second b
|
-%%%%%%%
|
||||||
7 : >>>>>>>
|
--second base
|
||||||
Resolved conflict in this_file_has_a_very_long_name_to_test_padding:
|
-+second a
|
||||||
1 : <<<<<<<
|
-+++++++
|
||||||
2 : %%%%%%%
|
-second b
|
||||||
3 1: second resolution for auto-firstchosen basefile
|
->>>>>>>
|
||||||
4 : +first a
|
+first resolution for auto-chosen file
|
||||||
5 : +++++++
|
diff --git a/this_file_has_a_very_long_name_to_test_padding b/this_file_has_a_very_long_name_to_test_padding
|
||||||
6 : first b
|
index 0000000000...f8c72adf17 100644
|
||||||
7 : >>>>>>>
|
--- a/this_file_has_a_very_long_name_to_test_padding
|
||||||
|
+++ b/this_file_has_a_very_long_name_to_test_padding
|
||||||
|
@@ -1,7 +1,1 @@
|
||||||
|
-<<<<<<<
|
||||||
|
-%%%%%%%
|
||||||
|
--first base
|
||||||
|
-+first a
|
||||||
|
-+++++++
|
||||||
|
-first b
|
||||||
|
->>>>>>>
|
||||||
|
+second resolution for auto-chosen file
|
||||||
"###);
|
"###);
|
||||||
|
|
||||||
insta::assert_snapshot!(test_env.jj_cmd_cli_error(&repo_path, &["resolve", "--list"]),
|
insta::assert_snapshot!(test_env.jj_cmd_cli_error(&repo_path, &["resolve", "--list"]),
|
||||||
|
|
Loading…
Reference in a new issue