mirror of
https://github.com/martinvonz/jj.git
synced 2025-02-01 00:50:57 +00:00
tests: add partial/multi-source squashes to obslog test
This commit is contained in:
parent
c99f502c31
commit
83ee6489d9
1 changed files with 48 additions and 4 deletions
|
@ -234,27 +234,71 @@ fn test_obslog_squash() {
|
||||||
test_env.jj_cmd_ok(&repo_path, &["new", "-m", "second"]);
|
test_env.jj_cmd_ok(&repo_path, &["new", "-m", "second"]);
|
||||||
std::fs::write(repo_path.join("file1"), "foo\nbar\n").unwrap();
|
std::fs::write(repo_path.join("file1"), "foo\nbar\n").unwrap();
|
||||||
|
|
||||||
|
// full
|
||||||
test_env.jj_cmd_ok(&repo_path, &["squash", "-m", "squashed 1"]);
|
test_env.jj_cmd_ok(&repo_path, &["squash", "-m", "squashed 1"]);
|
||||||
|
|
||||||
test_env.jj_cmd_ok(&repo_path, &["describe", "-m", "third"]);
|
test_env.jj_cmd_ok(&repo_path, &["describe", "-m", "third"]);
|
||||||
std::fs::write(repo_path.join("file1"), "foo\nbar\nbaz\n").unwrap();
|
std::fs::write(repo_path.join("file1"), "foo\nbar\nbaz\n").unwrap();
|
||||||
|
std::fs::write(repo_path.join("file2"), "foo2\n").unwrap();
|
||||||
|
std::fs::write(repo_path.join("file3"), "foo3\n").unwrap();
|
||||||
|
|
||||||
test_env.jj_cmd_ok(&repo_path, &["squash", "-m", "squashed 2"]);
|
// partial
|
||||||
|
test_env.jj_cmd_ok(&repo_path, &["squash", "-m", "squashed 2", "file1"]);
|
||||||
|
|
||||||
let stdout = test_env.jj_cmd_success(&repo_path, &["obslog", "-p", "-r", "@-"]);
|
test_env.jj_cmd_ok(&repo_path, &["new", "-m", "fourth"]);
|
||||||
|
std::fs::write(repo_path.join("file4"), "foo4\n").unwrap();
|
||||||
|
|
||||||
|
test_env.jj_cmd_ok(&repo_path, &["new", "-m", "fifth"]);
|
||||||
|
std::fs::write(repo_path.join("file5"), "foo5\n").unwrap();
|
||||||
|
|
||||||
|
// multiple sources
|
||||||
|
test_env.jj_cmd_ok(
|
||||||
|
&repo_path,
|
||||||
|
&[
|
||||||
|
"squash",
|
||||||
|
"-msquashed 3",
|
||||||
|
"--from=description('fourth')|description('fifth')",
|
||||||
|
"--into=description('squash')",
|
||||||
|
],
|
||||||
|
);
|
||||||
|
|
||||||
|
let stdout =
|
||||||
|
test_env.jj_cmd_success(&repo_path, &["obslog", "-p", "-r", "description('squash')"]);
|
||||||
insta::assert_snapshot!(stdout, @r###"
|
insta::assert_snapshot!(stdout, @r###"
|
||||||
○ qpvuntsm test.user@example.com 2001-02-03 08:05:12 1408a0a7
|
○ qpvuntsm test.user@example.com 2001-02-03 08:05:15 d49749bf
|
||||||
|
├─┬─╮ squashed 3
|
||||||
|
│ │ │ Added regular file file4:
|
||||||
|
│ │ │ 1: foo4
|
||||||
|
│ │ │ Added regular file file5:
|
||||||
|
│ │ │ 1: foo5
|
||||||
|
│ │ ○ vruxwmqv hidden test.user@example.com 2001-02-03 08:05:15 8f2ae2b5
|
||||||
|
│ │ │ fifth
|
||||||
|
│ │ │ Added regular file file5:
|
||||||
|
│ │ │ 1: foo5
|
||||||
|
│ │ ○ vruxwmqv hidden test.user@example.com 2001-02-03 08:05:14 04d28ca9
|
||||||
|
│ │ (empty) fifth
|
||||||
|
│ ○ yqosqzyt hidden test.user@example.com 2001-02-03 08:05:14 c5801e10
|
||||||
|
│ │ fourth
|
||||||
|
│ │ Added regular file file4:
|
||||||
|
│ │ 1: foo4
|
||||||
|
│ ○ yqosqzyt hidden test.user@example.com 2001-02-03 08:05:13 bb54a199
|
||||||
|
│ (empty) fourth
|
||||||
|
○ qpvuntsm hidden test.user@example.com 2001-02-03 08:05:12 1408a0a7
|
||||||
├─╮ squashed 2
|
├─╮ squashed 2
|
||||||
│ │ Modified regular file file1:
|
│ │ Modified regular file file1:
|
||||||
│ │ 1 1: foo
|
│ │ 1 1: foo
|
||||||
│ │ 2 2: bar
|
│ │ 2 2: bar
|
||||||
│ │ 3: baz
|
│ │ 3: baz
|
||||||
│ ○ zsuskuln hidden test.user@example.com 2001-02-03 08:05:12 7015a42c
|
│ ○ zsuskuln hidden test.user@example.com 2001-02-03 08:05:12 c9460789
|
||||||
│ │ third
|
│ │ third
|
||||||
│ │ Modified regular file file1:
|
│ │ Modified regular file file1:
|
||||||
│ │ 1 1: foo
|
│ │ 1 1: foo
|
||||||
│ │ 2 2: bar
|
│ │ 2 2: bar
|
||||||
│ │ 3: baz
|
│ │ 3: baz
|
||||||
|
│ │ Added regular file file2:
|
||||||
|
│ │ 1: foo2
|
||||||
|
│ │ Added regular file file3:
|
||||||
|
│ │ 1: foo3
|
||||||
│ ○ zsuskuln hidden test.user@example.com 2001-02-03 08:05:11 66645763
|
│ ○ zsuskuln hidden test.user@example.com 2001-02-03 08:05:11 66645763
|
||||||
│ │ (empty) third
|
│ │ (empty) third
|
||||||
│ ○ zsuskuln hidden test.user@example.com 2001-02-03 08:05:10 1c7afcb4
|
│ ○ zsuskuln hidden test.user@example.com 2001-02-03 08:05:10 1c7afcb4
|
||||||
|
|
Loading…
Reference in a new issue