forked from mirrors/jj
merge: simply print interleaved conflict values in debug output
We could apply that for the resolved case, but Resolved/Conflicted label seems more useful than just printing Merge([value]).
This commit is contained in:
parent
b07b370ed3
commit
f1898a31b5
3 changed files with 25 additions and 37 deletions
|
@ -68,7 +68,7 @@ fn test_chmod_regular_conflict() {
|
|||
let stdout = test_env.jj_cmd_success(&repo_path, &["debug", "tree"]);
|
||||
insta::assert_snapshot!(stdout,
|
||||
@r###"
|
||||
file: Conflicted { removes: [Some(File { id: FileId("df967b96a579e45a18b8251732d16804b2e56a55"), executable: false })], adds: [Some(File { id: FileId("587be6b4c3f93f93c489c0111bba5596147a26cb"), executable: true }), Some(File { id: FileId("8ba3a16384aacc37d01564b28401755ce8053f51"), executable: false })] }
|
||||
file: Conflicted([Some(File { id: FileId("587be6b4c3f93f93c489c0111bba5596147a26cb"), executable: true }), Some(File { id: FileId("df967b96a579e45a18b8251732d16804b2e56a55"), executable: false }), Some(File { id: FileId("8ba3a16384aacc37d01564b28401755ce8053f51"), executable: false })])
|
||||
"###);
|
||||
let stdout = test_env.jj_cmd_success(&repo_path, &["cat", "file"]);
|
||||
insta::assert_snapshot!(stdout,
|
||||
|
@ -87,7 +87,7 @@ fn test_chmod_regular_conflict() {
|
|||
let stdout = test_env.jj_cmd_success(&repo_path, &["debug", "tree"]);
|
||||
insta::assert_snapshot!(stdout,
|
||||
@r###"
|
||||
file: Conflicted { removes: [Some(File { id: FileId("df967b96a579e45a18b8251732d16804b2e56a55"), executable: true })], adds: [Some(File { id: FileId("587be6b4c3f93f93c489c0111bba5596147a26cb"), executable: true }), Some(File { id: FileId("8ba3a16384aacc37d01564b28401755ce8053f51"), executable: true })] }
|
||||
file: Conflicted([Some(File { id: FileId("587be6b4c3f93f93c489c0111bba5596147a26cb"), executable: true }), Some(File { id: FileId("df967b96a579e45a18b8251732d16804b2e56a55"), executable: true }), Some(File { id: FileId("8ba3a16384aacc37d01564b28401755ce8053f51"), executable: true })])
|
||||
"###);
|
||||
let stdout = test_env.jj_cmd_success(&repo_path, &["cat", "file"]);
|
||||
insta::assert_snapshot!(stdout,
|
||||
|
@ -104,7 +104,7 @@ fn test_chmod_regular_conflict() {
|
|||
let stdout = test_env.jj_cmd_success(&repo_path, &["debug", "tree"]);
|
||||
insta::assert_snapshot!(stdout,
|
||||
@r###"
|
||||
file: Conflicted { removes: [Some(File { id: FileId("df967b96a579e45a18b8251732d16804b2e56a55"), executable: false })], adds: [Some(File { id: FileId("587be6b4c3f93f93c489c0111bba5596147a26cb"), executable: false }), Some(File { id: FileId("8ba3a16384aacc37d01564b28401755ce8053f51"), executable: false })] }
|
||||
file: Conflicted([Some(File { id: FileId("587be6b4c3f93f93c489c0111bba5596147a26cb"), executable: false }), Some(File { id: FileId("df967b96a579e45a18b8251732d16804b2e56a55"), executable: false }), Some(File { id: FileId("8ba3a16384aacc37d01564b28401755ce8053f51"), executable: false })])
|
||||
"###);
|
||||
let stdout = test_env.jj_cmd_success(&repo_path, &["cat", "file"]);
|
||||
insta::assert_snapshot!(stdout,
|
||||
|
@ -127,7 +127,7 @@ fn test_chmod_regular_conflict() {
|
|||
let stdout = test_env.jj_cmd_success(&repo_path, &["debug", "tree"]);
|
||||
insta::assert_snapshot!(stdout,
|
||||
@r###"
|
||||
file: Conflicted { removes: [Some(File { id: FileId("df967b96a579e45a18b8251732d16804b2e56a55"), executable: false })], adds: [Some(File { id: FileId("587be6b4c3f93f93c489c0111bba5596147a26cb"), executable: false }), Some(File { id: FileId("8ba3a16384aacc37d01564b28401755ce8053f51"), executable: false })] }
|
||||
file: Conflicted([Some(File { id: FileId("587be6b4c3f93f93c489c0111bba5596147a26cb"), executable: false }), Some(File { id: FileId("df967b96a579e45a18b8251732d16804b2e56a55"), executable: false }), Some(File { id: FileId("8ba3a16384aacc37d01564b28401755ce8053f51"), executable: false })])
|
||||
"###);
|
||||
let stdout = test_env.jj_cmd_success(&repo_path, &["cat", "file"]);
|
||||
insta::assert_snapshot!(stdout,
|
||||
|
@ -190,7 +190,7 @@ fn test_chmod_file_dir_deletion_conflicts() {
|
|||
let stdout = test_env.jj_cmd_success(&repo_path, &["debug", "tree", "-r=file_dir"]);
|
||||
insta::assert_snapshot!(stdout,
|
||||
@r###"
|
||||
file: Conflicted { removes: [Some(File { id: FileId("df967b96a579e45a18b8251732d16804b2e56a55"), executable: false })], adds: [Some(File { id: FileId("78981922613b2afb6025042ff6bd878ac1994e85"), executable: false }), Some(Tree(TreeId("133bb38fc4e4bf6b551f1f04db7e48f04cac2877")))] }
|
||||
file: Conflicted([Some(File { id: FileId("78981922613b2afb6025042ff6bd878ac1994e85"), executable: false }), Some(File { id: FileId("df967b96a579e45a18b8251732d16804b2e56a55"), executable: false }), Some(Tree(TreeId("133bb38fc4e4bf6b551f1f04db7e48f04cac2877")))])
|
||||
"###);
|
||||
let stdout = test_env.jj_cmd_success(&repo_path, &["cat", "-r=file_dir", "file"]);
|
||||
insta::assert_snapshot!(stdout,
|
||||
|
@ -209,7 +209,7 @@ fn test_chmod_file_dir_deletion_conflicts() {
|
|||
let stdout = test_env.jj_cmd_success(&repo_path, &["debug", "tree", "-r=file_deletion"]);
|
||||
insta::assert_snapshot!(stdout,
|
||||
@r###"
|
||||
file: Conflicted { removes: [Some(File { id: FileId("df967b96a579e45a18b8251732d16804b2e56a55"), executable: false })], adds: [Some(File { id: FileId("78981922613b2afb6025042ff6bd878ac1994e85"), executable: false }), None] }
|
||||
file: Conflicted([Some(File { id: FileId("78981922613b2afb6025042ff6bd878ac1994e85"), executable: false }), Some(File { id: FileId("df967b96a579e45a18b8251732d16804b2e56a55"), executable: false }), None])
|
||||
"###);
|
||||
let stdout = test_env.jj_cmd_success(&repo_path, &["cat", "-r=file_deletion", "file"]);
|
||||
insta::assert_snapshot!(stdout,
|
||||
|
@ -233,7 +233,7 @@ fn test_chmod_file_dir_deletion_conflicts() {
|
|||
let stdout = test_env.jj_cmd_success(&repo_path, &["debug", "tree", "-r=file_deletion"]);
|
||||
insta::assert_snapshot!(stdout,
|
||||
@r###"
|
||||
file: Conflicted { removes: [Some(File { id: FileId("df967b96a579e45a18b8251732d16804b2e56a55"), executable: true })], adds: [Some(File { id: FileId("78981922613b2afb6025042ff6bd878ac1994e85"), executable: true }), None] }
|
||||
file: Conflicted([Some(File { id: FileId("78981922613b2afb6025042ff6bd878ac1994e85"), executable: true }), Some(File { id: FileId("df967b96a579e45a18b8251732d16804b2e56a55"), executable: true }), None])
|
||||
"###);
|
||||
let stdout = test_env.jj_cmd_success(&repo_path, &["cat", "-r=file_deletion", "file"]);
|
||||
insta::assert_snapshot!(stdout,
|
||||
|
|
|
@ -125,11 +125,7 @@ impl<T: Debug> Debug for Merge<T> {
|
|||
if let Some(value) = self.as_resolved() {
|
||||
f.debug_tuple("Resolved").field(value).finish()
|
||||
} else {
|
||||
// TODO: just print values?
|
||||
f.debug_struct("Conflicted")
|
||||
.field("removes", &self.removes().collect_vec())
|
||||
.field("adds", &self.adds().collect_vec())
|
||||
.finish()
|
||||
f.debug_tuple("Conflicted").field(&self.values).finish()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -304,27 +304,23 @@ line 5 right
|
|||
@r###"
|
||||
Some(
|
||||
[
|
||||
Conflicted {
|
||||
removes: [
|
||||
"line 1\nline 2\n",
|
||||
],
|
||||
adds: [
|
||||
Conflicted(
|
||||
[
|
||||
"line 1 left\nline 2 left\n",
|
||||
"line 1\nline 2\n",
|
||||
"line 1 right\nline 2\n",
|
||||
],
|
||||
},
|
||||
),
|
||||
Resolved(
|
||||
"line 3\n",
|
||||
),
|
||||
Conflicted {
|
||||
removes: [
|
||||
"line 4\nline 5\n",
|
||||
],
|
||||
adds: [
|
||||
Conflicted(
|
||||
[
|
||||
"line 4\nline 5 left\n",
|
||||
"line 4\nline 5\n",
|
||||
"line 4 right\nline 5 right\n",
|
||||
],
|
||||
},
|
||||
),
|
||||
],
|
||||
)
|
||||
"###);
|
||||
|
@ -464,15 +460,13 @@ line 5
|
|||
Resolved(
|
||||
"line 1\n",
|
||||
),
|
||||
Conflicted {
|
||||
removes: [
|
||||
"line 2\nline 3\nline 4\n",
|
||||
],
|
||||
adds: [
|
||||
Conflicted(
|
||||
[
|
||||
"line 2\nleft\nline 4\n",
|
||||
"line 2\nline 3\nline 4\n",
|
||||
"right\n",
|
||||
],
|
||||
},
|
||||
),
|
||||
Resolved(
|
||||
"line 5\n",
|
||||
),
|
||||
|
@ -511,17 +505,15 @@ line 5
|
|||
Resolved(
|
||||
"line 1\n",
|
||||
),
|
||||
Conflicted {
|
||||
removes: [
|
||||
"line 2\nline 3\nline 4\n",
|
||||
"line 2\nline 3\nline 4\n",
|
||||
],
|
||||
adds: [
|
||||
Conflicted(
|
||||
[
|
||||
"line 2\nleft\nline 4\n",
|
||||
"line 2\nline 3\nline 4\n",
|
||||
"right\n",
|
||||
"line 2\nline 3\nline 4\n",
|
||||
"line 2\nforward\nline 3\nline 4\n",
|
||||
],
|
||||
},
|
||||
),
|
||||
Resolved(
|
||||
"line 5\n",
|
||||
),
|
||||
|
|
Loading…
Reference in a new issue