forked from mirrors/jj
tests: add unsnapshotted changes in secondary workspace in recovery test
This adds modifed, removed, and added files in the secondary working copy.
This commit is contained in:
parent
df9434bd4b
commit
0d197791a0
1 changed files with 36 additions and 18 deletions
|
@ -417,10 +417,17 @@ fn test_workspaces_current_op_discarded_by_other() {
|
||||||
let main_path = test_env.env_root().join("main");
|
let main_path = test_env.env_root().join("main");
|
||||||
let secondary_path = test_env.env_root().join("secondary");
|
let secondary_path = test_env.env_root().join("secondary");
|
||||||
|
|
||||||
std::fs::write(main_path.join("file"), "contents\n").unwrap();
|
std::fs::write(main_path.join("modified"), "base\n").unwrap();
|
||||||
|
std::fs::write(main_path.join("deleted"), "base\n").unwrap();
|
||||||
|
test_env.jj_cmd_ok(&main_path, &["new"]);
|
||||||
|
std::fs::write(main_path.join("modified"), "main\n").unwrap();
|
||||||
test_env.jj_cmd_ok(&main_path, &["new"]);
|
test_env.jj_cmd_ok(&main_path, &["new"]);
|
||||||
|
|
||||||
test_env.jj_cmd_ok(&main_path, &["workspace", "add", "../secondary"]);
|
test_env.jj_cmd_ok(&main_path, &["workspace", "add", "../secondary"]);
|
||||||
|
// Make unsnapshotted writes in the secondary working copy
|
||||||
|
std::fs::write(secondary_path.join("modified"), "secondary\n").unwrap();
|
||||||
|
std::fs::remove_file(secondary_path.join("deleted")).unwrap();
|
||||||
|
std::fs::write(secondary_path.join("added"), "secondary\n").unwrap();
|
||||||
|
|
||||||
// Create an op by abandoning the parent commit. Importantly, that commit also
|
// Create an op by abandoning the parent commit. Importantly, that commit also
|
||||||
// changes the target tree in the secondary workspace.
|
// changes the target tree in the secondary workspace.
|
||||||
|
@ -436,11 +443,13 @@ fn test_workspaces_current_op_discarded_by_other() {
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
insta::assert_snapshot!(stdout, @r###"
|
insta::assert_snapshot!(stdout, @r###"
|
||||||
@ f1dc1bf396 abandon commit acb4b92517b20aa4ee2f3dc58d7c2373754d0b29a3df310dbabda5813f13c3730d28d6a1b6dd37f3b0c8c5c9adaead5dab242ffe7ecc2e5a6a534fe4c6639f89
|
@ ca4014fc13 abandon commit 9e69961a6cb8dc42410fa11421c5ce14c9ba4dba3d85c99b3f5d7214e01c09211d3f6abf0a5502038bc9531d4d7828a4b3e978ca4f64f6cb5b00f4181c1710cc
|
||||||
◉ 47f1ad5e1a Create initial working-copy commit in workspace secondary
|
◉ b7e3c248b3 Create initial working-copy commit in workspace secondary
|
||||||
◉ fd918ce207 add workspace 'secondary'
|
◉ 3a464a164b add workspace 'secondary'
|
||||||
◉ 5927500c4b new empty commit
|
◉ 1a8a57ad06 new empty commit
|
||||||
◉ c86cb4fdf4 snapshot working copy
|
◉ 34dce00889 snapshot working copy
|
||||||
|
◉ 64b8644c69 new empty commit
|
||||||
|
◉ 983fc29dc3 snapshot working copy
|
||||||
◉ 17dbb2fe40 add workspace 'default'
|
◉ 17dbb2fe40 add workspace 'default'
|
||||||
◉ cecfee9647 initialize repo
|
◉ cecfee9647 initialize repo
|
||||||
◉ 0000000000
|
◉ 0000000000
|
||||||
|
@ -451,9 +460,10 @@ fn test_workspaces_current_op_discarded_by_other() {
|
||||||
test_env.jj_cmd_ok(&main_path, &["util", "gc", "--expire=now"]);
|
test_env.jj_cmd_ok(&main_path, &["util", "gc", "--expire=now"]);
|
||||||
|
|
||||||
insta::assert_snapshot!(get_log_output(&test_env, &main_path), @r###"
|
insta::assert_snapshot!(get_log_output(&test_env, &main_path), @r###"
|
||||||
@ 6dc8f254cd3c default@
|
@ b026dbb4ded8 default@
|
||||||
│ ◉ 4278b78fb503 secondary@
|
│ ◉ 11b31a7bf02c secondary@
|
||||||
├─╯
|
├─╯
|
||||||
|
◉ cab81fe8ecb0
|
||||||
◉ 000000000000
|
◉ 000000000000
|
||||||
"###);
|
"###);
|
||||||
|
|
||||||
|
@ -466,16 +476,17 @@ fn test_workspaces_current_op_discarded_by_other() {
|
||||||
|
|
||||||
let (stdout, stderr) = test_env.jj_cmd_ok(&secondary_path, &["workspace", "update-stale"]);
|
let (stdout, stderr) = test_env.jj_cmd_ok(&secondary_path, &["workspace", "update-stale"]);
|
||||||
insta::assert_snapshot!(stderr, @r###"
|
insta::assert_snapshot!(stderr, @r###"
|
||||||
Failed to read working copy's current operation; attempting recovery. Error message from read attempt: Object 47f1ad5e1adfaa1e9863181e6e45ae12b9db553e82bde82e278c0c6288053c833b4039a5baf2415871964bcdcd4b7875692979e66f2ec18bfc3896355091cf53 of type operation not found
|
Failed to read working copy's current operation; attempting recovery. Error message from read attempt: Object b7e3c248b31b30b9ebe9bc0960bb5138a9832745f0e02d76e7dc9e65a44fcfd092cdf9e22e6ca84498dc496dd08c22027ecc3ba8fc45ab54bf565b9cda13eca6 of type operation not found
|
||||||
Created and checked out recovery commit df3e46148439
|
Created and checked out recovery commit 1e90e5d2ab94
|
||||||
"###);
|
"###);
|
||||||
insta::assert_snapshot!(stdout, @"");
|
insta::assert_snapshot!(stdout, @"");
|
||||||
|
|
||||||
insta::assert_snapshot!(get_log_output(&test_env, &main_path), @r###"
|
insta::assert_snapshot!(get_log_output(&test_env, &main_path), @r###"
|
||||||
◉ 54400d0c58b7 secondary@
|
◉ bffc5782a10d secondary@
|
||||||
◉ 4278b78fb503
|
◉ 11b31a7bf02c
|
||||||
│ @ 6dc8f254cd3c default@
|
│ @ b026dbb4ded8 default@
|
||||||
├─╯
|
├─╯
|
||||||
|
◉ cab81fe8ecb0
|
||||||
◉ 000000000000
|
◉ 000000000000
|
||||||
"###);
|
"###);
|
||||||
|
|
||||||
|
@ -483,17 +494,24 @@ fn test_workspaces_current_op_discarded_by_other() {
|
||||||
insta::assert_snapshot!(stderr, @"");
|
insta::assert_snapshot!(stderr, @"");
|
||||||
insta::assert_snapshot!(stdout, @r###"
|
insta::assert_snapshot!(stdout, @r###"
|
||||||
Working copy changes:
|
Working copy changes:
|
||||||
A file
|
A added
|
||||||
Working copy : znkkpsqq 54400d0c (no description set)
|
D deleted
|
||||||
Parent commit: pmmvwywv 4278b78f (empty) (no description set)
|
M modified
|
||||||
|
Working copy : kpqxywon bffc5782 (no description set)
|
||||||
|
Parent commit: rzvqmyuk 11b31a7b (empty) (no description set)
|
||||||
|
"###);
|
||||||
|
// The modified file should have the same contents it had before (not reset to
|
||||||
|
// the base contents)
|
||||||
|
insta::assert_snapshot!(std::fs::read_to_string(secondary_path.join("modified")).unwrap(), @r###"
|
||||||
|
secondary
|
||||||
"###);
|
"###);
|
||||||
|
|
||||||
let (stdout, stderr) = test_env.jj_cmd_ok(&secondary_path, &["obslog"]);
|
let (stdout, stderr) = test_env.jj_cmd_ok(&secondary_path, &["obslog"]);
|
||||||
insta::assert_snapshot!(stderr, @"");
|
insta::assert_snapshot!(stderr, @"");
|
||||||
insta::assert_snapshot!(stdout, @r###"
|
insta::assert_snapshot!(stdout, @r###"
|
||||||
@ znkkpsqq test.user@example.com 2001-02-03 04:05:16.000 +07:00 secondary@ 54400d0c
|
@ kpqxywon test.user@example.com 2001-02-03 04:05:17.000 +07:00 secondary@ bffc5782
|
||||||
│ (no description set)
|
│ (no description set)
|
||||||
◉ znkkpsqq hidden test.user@example.com 2001-02-03 04:05:16.000 +07:00 df3e4614
|
◉ kpqxywon hidden test.user@example.com 2001-02-03 04:05:17.000 +07:00 1e90e5d2
|
||||||
(empty) (no description set)
|
(empty) (no description set)
|
||||||
"###);
|
"###);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue