-
Notifications
You must be signed in to change notification settings - Fork 360
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cli: Add an option to record consecutive snapshots as a single op
- Loading branch information
Showing
10 changed files
with
135 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -69,10 +69,10 @@ fn test_concurrent_operations_auto_rebase() { | |
test_env.jj_cmd_ok(&repo_path, &["describe", "-m", "initial"]); | ||
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "log"]); | ||
insta::assert_snapshot!(stdout, @r###" | ||
@ d5b4f16ef469 [email protected] 2001-02-03 04:05:08.000 +07:00 - 2001-02-03 04:05:08.000 +07:00 | ||
@ faefa12d4ced [email protected] 2001-02-03 04:05:08.000 +07:00 - 2001-02-03 04:05:08.000 +07:00 | ||
│ describe commit 123ed18e4c4c0d77428df41112bc02ffc83fb935 | ||
│ args: jj describe -m initial | ||
◉ e632e64d7fa1 [email protected] 2001-02-03 04:05:08.000 +07:00 - 2001-02-03 04:05:08.000 +07:00 | ||
◉ 75021f3fc19d [email protected] 2001-02-03 04:05:08.000 +07:00 - 2001-02-03 04:05:08.000 +07:00 | ||
│ snapshot working copy | ||
│ args: jj describe -m initial | ||
◉ 6ac4339ad699 [email protected] 2001-02-03 04:05:07.000 +07:00 - 2001-02-03 04:05:07.000 +07:00 | ||
|
@@ -184,16 +184,16 @@ fn test_concurrent_snapshot_wc_reloadable() { | |
let template = r#"id ++ "\n" ++ description ++ "\n" ++ tags"#; | ||
let op_log_stdout = test_env.jj_cmd_success(&repo_path, &["op", "log", "-T", template]); | ||
insta::assert_snapshot!(op_log_stdout, @r###" | ||
@ 1578600dd63556a22abef7cf6e7054a7e07468187ba31f79d0aa6a197b17004b7cd3e19d2fab1e6a00f2520b48d41969dbbb562c60d4c4af9436224f7f14ab83 | ||
@ bc38b5d20b2843d546bf5d40d8e1897be131b2ede73b4de031d3b2c6ac394e454a24f52196687accc8d27eb99aaadd8e1d63a8d30a2cb22efae0e3232492bc86 | ||
│ commit 323b414dd255b51375d7f4392b7b2641ffe4289f | ||
│ args: jj commit -m 'new child1' | ||
◉ 90bb10893e980b606939a1f45f2aadf7de1eef65589ac5cd70e20dc20dfd0073c989b5ba0de70ce79a52d27aab5f5699eba66649b531530be5d13bc12c6bd926 | ||
◉ af69a63bdc3c88f12e0b1fbc673bce01eb46087b8c6629efd57cb9e68d72973d928f738f2e51504959dc5f531f68a15321f6c9560bca9862f5e850a872ce0c30 | ||
│ snapshot working copy | ||
│ args: jj commit -m 'new child1' | ||
◉ 6104865e95226d46d8c6f5bf43ab025e67f88da6e27f8d8cc598c6d058e333126380c4cb25ea49c841480efee82ce2c602d87b4d3f53b85b4e704af5e83cbdc9 | ||
◉ 2af019579b0b19d9a147df4779e587b92061fb5cd18fe9ba6d8a33cbeac205ced27c7f411df78278626993725ace7738da9352addb6699898e252c75f57f6f93 | ||
│ commit 3d918700494a9895696e955b85fa05eb0d314cc6 | ||
│ args: jj commit -m initial | ||
◉ 76137fc212ef44c53db04be2010ba0419db1fe30e31289bed7d1d0410bee7c3c93d8fd5f6d1b03d93801a2517c436cc1bc4cc512c740e2d88979e771a6fb3730 | ||
◉ c07152a7412fac7a7b5570176a1f8799e878c9ec75c7f69633943e6d59a555b7b778804c5b930ce3528e787c5e221c3874b470abb1ff97a2663a4df21f9e09d2 | ||
│ snapshot working copy | ||
│ args: jj commit -m initial | ||
◉ 6ac4339ad6999058dd1806653ec37fc0091c1cc17419c750fddc5e8c1a6a77829e6dd70b3408403fb2c0b9839cf6bfd1c270f980674f7f89d4d78dc54082a8ef | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,3 +30,45 @@ fn test_snapshot_large_file() { | |
want this file to be snapshotted. Otherwise add it to your `.gitignore` file. | ||
"###); | ||
} | ||
|
||
#[test] | ||
fn test_consecutive_snapshots() { | ||
let test_env = TestEnvironment::default(); | ||
test_env.jj_cmd_ok(test_env.env_root(), &["init", "repo", "--git"]); | ||
let repo_path = test_env.env_root().join("repo"); | ||
|
||
test_env.add_config(r#"snapshot.squash-consecutive-snapshots = true"#); | ||
|
||
test_env.jj_cmd_ok(&repo_path, &["describe", "-m", "sample text"]); | ||
// initial WC is a predecessor of a described WC now | ||
|
||
std::fs::write(repo_path.join("a"), "").unwrap(); | ||
test_env.jj_cmd_success(&repo_path, &["files"]); | ||
|
||
std::fs::write(repo_path.join("b"), "").unwrap(); | ||
test_env.jj_cmd_success(&repo_path, &["files"]); | ||
|
||
let stdout = test_env.jj_cmd_success(&repo_path, &["operation", "log"]); | ||
insta::assert_snapshot!(stdout, @r###" | ||
@ 70756af40ab9 [email protected] 2001-02-03 04:05:10.000 +07:00 - 2001-02-03 04:05:10.000 +07:00 | ||
│ snapshot working copy | ||
│ args: jj files | ||
│ snapshots: 2 | ||
◉ 4f5b67be313f [email protected] 2001-02-03 04:05:08.000 +07:00 - 2001-02-03 04:05:08.000 +07:00 | ||
│ describe commit 230dd059e1b059aefc0da06a2e5a7dbf22362f22 | ||
│ args: jj describe -m 'sample text' | ||
◉ 6ac4339ad699 [email protected] 2001-02-03 04:05:07.000 +07:00 - 2001-02-03 04:05:07.000 +07:00 | ||
│ add workspace 'default' | ||
◉ 1b0049c19762 [email protected] 2001-02-03 04:05:07.000 +07:00 - 2001-02-03 04:05:07.000 +07:00 | ||
│ initialize repo | ||
◉ 000000000000 root() | ||
"###); | ||
|
||
let stdout = test_env.jj_cmd_success(&repo_path, &["obslog"]); | ||
insta::assert_snapshot!(stdout, @r###" | ||
@ qpvuntsm [email protected] 2001-02-03 04:05:10.000 +07:00 bf6e46e6 | ||
│ sample text | ||
◉ qpvuntsm hidden [email protected] 2001-02-03 04:05:07.000 +07:00 230dd059 | ||
(empty) (no description set) | ||
"###); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -297,14 +297,14 @@ fn test_workspaces_conflicting_edits() { | |
"###); | ||
let stderr = test_env.jj_cmd_failure(&secondary_path, &["st"]); | ||
insta::assert_snapshot!(stderr, @r###" | ||
Error: The working copy is stale (not updated since operation d93fe4c5a6d1). | ||
Error: The working copy is stale (not updated since operation 279268a28063). | ||
Hint: Run `jj workspace update-stale` to update it. | ||
See https://github.com/martinvonz/jj/blob/main/docs/working-copy.md#stale-working-copy for more information. | ||
"###); | ||
// Same error on second run, and from another command | ||
let stderr = test_env.jj_cmd_failure(&secondary_path, &["log"]); | ||
insta::assert_snapshot!(stderr, @r###" | ||
Error: The working copy is stale (not updated since operation d93fe4c5a6d1). | ||
Error: The working copy is stale (not updated since operation 279268a28063). | ||
Hint: Run `jj workspace update-stale` to update it. | ||
See https://github.com/martinvonz/jj/blob/main/docs/working-copy.md#stale-working-copy for more information. | ||
"###); | ||
|
@@ -384,7 +384,7 @@ fn test_workspaces_updated_by_other() { | |
"###); | ||
let stderr = test_env.jj_cmd_failure(&secondary_path, &["st"]); | ||
insta::assert_snapshot!(stderr, @r###" | ||
Error: The working copy is stale (not updated since operation d93fe4c5a6d1). | ||
Error: The working copy is stale (not updated since operation 279268a28063). | ||
Hint: Run `jj workspace update-stale` to update it. | ||
See https://github.com/martinvonz/jj/blob/main/docs/working-copy.md#stale-working-copy for more information. | ||
"###); | ||
|
@@ -436,11 +436,11 @@ fn test_workspaces_current_op_discarded_by_other() { | |
], | ||
); | ||
insta::assert_snapshot!(stdout, @r###" | ||
@ 09350a8134 abandon commit acb4b92517b20aa4ee2f3dc58d7c2373754d0b29a3df310dbabda5813f13c3730d28d6a1b6dd37f3b0c8c5c9adaead5dab242ffe7ecc2e5a6a534fe4c6639f89 | ||
◉ d8304661a2 Create initial working-copy commit in workspace secondary | ||
◉ 4ae0e83b98 add workspace 'secondary' | ||
◉ 00cc5ecf50 new empty commit | ||
◉ e0be7087ba snapshot working copy | ||
@ 4cbdebdfc0 abandon commit acb4b92517b20aa4ee2f3dc58d7c2373754d0b29a3df310dbabda5813f13c3730d28d6a1b6dd37f3b0c8c5c9adaead5dab242ffe7ecc2e5a6a534fe4c6639f89 | ||
◉ b4b07f3859 Create initial working-copy commit in workspace secondary | ||
◉ 68faf85152 add workspace 'secondary' | ||
◉ ab73dcd486 new empty commit | ||
◉ d47599bc7f snapshot working copy | ||
◉ d0bd64e0b3 add workspace 'default' | ||
◉ 06a74719e6 initialize repo | ||
◉ 0000000000 | ||
|
@@ -466,7 +466,7 @@ fn test_workspaces_current_op_discarded_by_other() { | |
|
||
let (stdout, stderr) = test_env.jj_cmd_ok(&secondary_path, &["workspace", "update-stale"]); | ||
insta::assert_snapshot!(stderr, @r###" | ||
Failed to read working copy's current operation; attempting recovery. Error message from read attempt: Object d8304661a23b0d8b9ecc517a465869d7c8b6563b460f029541fbe5246cc02718145c5ad8f7fed26863b46a68e79d609b878a7ea5a239baf530858e86e81e72d1 of type operation not found | ||
Failed to read working copy's current operation; attempting recovery. Error message from read attempt: Object b4b07f38593831f5a539a17138b9673936dd936f83bf22349c88127b5633cb3d22f94903518a7b673addafe31cc30b3518c30b01e6387417e68594df507cf4b5 of type operation not found | ||
Created and checked out recovery commit 9d040f9a433c | ||
"###); | ||
insta::assert_snapshot!(stdout, @""); | ||
|
@@ -658,7 +658,7 @@ fn test_workspaces_forget_multi_transaction() { | |
// the op log should have multiple workspaces forgotten in a single tx | ||
let stdout = test_env.jj_cmd_success(&main_path, &["op", "log", "--limit", "1"]); | ||
insta::assert_snapshot!(stdout, @r###" | ||
@ ea093f0a1a06 [email protected] 2001-02-03 04:05:12.000 +07:00 - 2001-02-03 04:05:12.000 +07:00 | ||
@ 119435f7fd1d [email protected] 2001-02-03 04:05:12.000 +07:00 - 2001-02-03 04:05:12.000 +07:00 | ||
│ forget workspaces second, third | ||
│ args: jj workspace forget second third | ||
"###); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters