diff --git a/cli/tests/test_concurrent_operations.rs b/cli/tests/test_concurrent_operations.rs index 12136e3e8..31e414790 100644 --- a/cli/tests/test_concurrent_operations.rs +++ b/cli/tests/test_concurrent_operations.rs @@ -33,15 +33,15 @@ fn test_concurrent_operation_divergence() { // "op log" doesn't merge the concurrent operations let stdout = test_env.jj_cmd_success(&repo_path, &["op", "log"]); insta::assert_snapshot!(stdout, @r###" - ◉ 31e3dc1f7c87 test-username@host.example.com 2001-02-03 04:05:09.000 +07:00 - 2001-02-03 04:05:09.000 +07:00 + ◉ 1e346ac76e7c test-username@host.example.com 2001-02-03 04:05:09.000 +07:00 - 2001-02-03 04:05:09.000 +07:00 │ describe commit 230dd059e1b059aefc0da06a2e5a7dbf22362f22 │ args: jj describe -m 'message 2' --at-op @- - │ ◉ e914ad151dae test-username@host.example.com 2001-02-03 04:05:08.000 +07:00 - 2001-02-03 04:05:08.000 +07:00 + │ ◉ 1fb59888922c test-username@host.example.com 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 'message 1' - ◉ 27143b59c690 test-username@host.example.com 2001-02-03 04:05:07.000 +07:00 - 2001-02-03 04:05:07.000 +07:00 + ◉ 6ac4339ad699 test-username@host.example.com 2001-02-03 04:05:07.000 +07:00 - 2001-02-03 04:05:07.000 +07:00 │ add workspace 'default' - ◉ 0e8aee02e242 test-username@host.example.com 2001-02-03 04:05:07.000 +07:00 - 2001-02-03 04:05:07.000 +07:00 + ◉ 1b0049c19762 test-username@host.example.com 2001-02-03 04:05:07.000 +07:00 - 2001-02-03 04:05:07.000 +07:00 │ initialize repo ◉ 000000000000 root() "###); @@ -69,15 +69,15 @@ 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###" - @ 621f22ef65b4 test-username@host.example.com 2001-02-03 04:05:08.000 +07:00 - 2001-02-03 04:05:08.000 +07:00 + @ d5b4f16ef469 test-username@host.example.com 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 - ◉ 17cb042ae103 test-username@host.example.com 2001-02-03 04:05:08.000 +07:00 - 2001-02-03 04:05:08.000 +07:00 + ◉ e632e64d7fa1 test-username@host.example.com 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 - ◉ 27143b59c690 test-username@host.example.com 2001-02-03 04:05:07.000 +07:00 - 2001-02-03 04:05:07.000 +07:00 + ◉ 6ac4339ad699 test-username@host.example.com 2001-02-03 04:05:07.000 +07:00 - 2001-02-03 04:05:07.000 +07:00 │ add workspace 'default' - ◉ 0e8aee02e242 test-username@host.example.com 2001-02-03 04:05:07.000 +07:00 - 2001-02-03 04:05:07.000 +07:00 + ◉ 1b0049c19762 test-username@host.example.com 2001-02-03 04:05:07.000 +07:00 - 2001-02-03 04:05:07.000 +07:00 │ initialize repo ◉ 000000000000 root() "###); @@ -184,21 +184,21 @@ 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###" - @ d726ace5612d3c99c793f61d5e86583f430fec332859af62a962f08c93cfac1459884371badcdaccbfd7b065c7df191d68fb35f6d537d1c0cc7ed18c70d6f1e5 + @ 1578600dd63556a22abef7cf6e7054a7e07468187ba31f79d0aa6a197b17004b7cd3e19d2fab1e6a00f2520b48d41969dbbb562c60d4c4af9436224f7f14ab83 │ commit 323b414dd255b51375d7f4392b7b2641ffe4289f │ args: jj commit -m 'new child1' - ◉ 5de87db156fa59f084be7beafb2e8921976cef54061d19671f1406f0f4bc3ad114e6bfee8d2e88e8d2614a49652b8f88071c48a9d78ff951dc81fcac8eb592f3 + ◉ 90bb10893e980b606939a1f45f2aadf7de1eef65589ac5cd70e20dc20dfd0073c989b5ba0de70ce79a52d27aab5f5699eba66649b531530be5d13bc12c6bd926 │ snapshot working copy │ args: jj commit -m 'new child1' - ◉ 1145f7c8a11bf57eb9bf7ee241a72c19e0fa536a35c099d9e72ad25a4475293f48e1f29eab90e31fa8770566199bf384dcb4f44227635c20d1e21ae2b9700303 + ◉ 6104865e95226d46d8c6f5bf43ab025e67f88da6e27f8d8cc598c6d058e333126380c4cb25ea49c841480efee82ce2c602d87b4d3f53b85b4e704af5e83cbdc9 │ commit 3d918700494a9895696e955b85fa05eb0d314cc6 │ args: jj commit -m initial - ◉ a10989671b09d46b636fa4dee86182a170f2b6a9d127a785e8d1388b0680affcc4aeed8bba1face7f3fc1637b7f9327f6ac7f4d9384f468333805a215363ccbd + ◉ 76137fc212ef44c53db04be2010ba0419db1fe30e31289bed7d1d0410bee7c3c93d8fd5f6d1b03d93801a2517c436cc1bc4cc512c740e2d88979e771a6fb3730 │ snapshot working copy │ args: jj commit -m initial - ◉ 27143b59c6904046f6be83ad6fe145d819944f9abbd7247ea9c57848d1d2c678ea8265598a156fe8aeef31d24d958bf6cfa0c2eb3afef40bdae2c5e98d73d0ee + ◉ 6ac4339ad6999058dd1806653ec37fc0091c1cc17419c750fddc5e8c1a6a77829e6dd70b3408403fb2c0b9839cf6bfd1c270f980674f7f89d4d78dc54082a8ef │ add workspace 'default' - ◉ 0e8aee02e24230c99d6d90d469c582a60fdb2ae8329341bbdb09f4a0beceba1ce7c84fc9ba6c7657d6d275b392b89b825502475ad2501be1ddebd4a09b07668c + ◉ 1b0049c19762e43499f2499a45afc9f72b3004d75a2863d41d8867cfafb9bbc8e16aa447107e460d58a5c1462429f032d806f7487836c66c6f351df45746c218 │ initialize repo ◉ 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 diff --git a/cli/tests/test_debug_command.rs b/cli/tests/test_debug_command.rs index 636dc659a..aade73827 100644 --- a/cli/tests/test_debug_command.rs +++ b/cli/tests/test_debug_command.rs @@ -125,7 +125,7 @@ fn test_debug_operation_id() { let stdout = test_env.jj_cmd_success(&workspace_path, &["debug", "operation", "--display", "id"]); assert_snapshot!(filter_index_stats(&stdout), @r###" - 27143b59c6904046f6be83ad6fe145d819944f9abbd7247ea9c57848d1d2c678ea8265598a156fe8aeef31d24d958bf6cfa0c2eb3afef40bdae2c5e98d73d0ee + 6ac4339ad6999058dd1806653ec37fc0091c1cc17419c750fddc5e8c1a6a77829e6dd70b3408403fb2c0b9839cf6bfd1c270f980674f7f89d4d78dc54082a8ef "### ); } diff --git a/cli/tests/test_operations.rs b/cli/tests/test_operations.rs index f77e691d8..2f63477da 100644 --- a/cli/tests/test_operations.rs +++ b/cli/tests/test_operations.rs @@ -36,12 +36,12 @@ fn test_op_log() { ], ); insta::assert_snapshot!(&stdout, @r###" - @ 826c45dd2457 test-username@host.example.com 2001-02-03 04:05:08.000 +07:00 - 2001-02-03 04:05:08.000 +07:00 + @ c12bcc2a82e7 test-username@host.example.com 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 'description 0' - ◉ 27143b59c690 test-username@host.example.com 2001-02-03 04:05:07.000 +07:00 - 2001-02-03 04:05:07.000 +07:00 + ◉ 6ac4339ad699 test-username@host.example.com 2001-02-03 04:05:07.000 +07:00 - 2001-02-03 04:05:07.000 +07:00 │ add workspace 'default' - ◉ 0e8aee02e242 test-username@host.example.com 2001-02-03 04:05:07.000 +07:00 - 2001-02-03 04:05:07.000 +07:00 + ◉ 1b0049c19762 test-username@host.example.com 2001-02-03 04:05:07.000 +07:00 - 2001-02-03 04:05:07.000 +07:00 │ initialize repo ◉ 000000000000 root() "###); @@ -114,9 +114,9 @@ fn test_op_log_no_graph() { let stdout = test_env.jj_cmd_success(&repo_path, &["op", "log", "--no-graph", "--color=always"]); insta::assert_snapshot!(stdout, @r###" - 27143b59c690 test-username@host.example.com 2001-02-03 04:05:07.000 +07:00 - 2001-02-03 04:05:07.000 +07:00 + 6ac4339ad699 test-username@host.example.com 2001-02-03 04:05:07.000 +07:00 - 2001-02-03 04:05:07.000 +07:00 add workspace 'default' - 0e8aee02e242 test-username@host.example.com 2001-02-03 04:05:07.000 +07:00 - 2001-02-03 04:05:07.000 +07:00 + 1b0049c19762 test-username@host.example.com 2001-02-03 04:05:07.000 +07:00 - 2001-02-03 04:05:07.000 +07:00 initialize repo 000000000000 root() "###); @@ -140,7 +140,7 @@ fn test_op_log_no_graph_null_terminated() { r#"id.short(4) ++ "\0""#, ], ); - insta::assert_debug_snapshot!(stdout, @r###""f5e4\05ff2\02714\00e8a\00000\0""###); + insta::assert_debug_snapshot!(stdout, @r###""050b\0c02e\06ac4\01b00\00000\0""###); } #[test] @@ -151,15 +151,15 @@ fn test_op_log_template() { let render = |template| test_env.jj_cmd_success(&repo_path, &["op", "log", "-T", template]); insta::assert_snapshot!(render(r#"id ++ "\n""#), @r###" - @ 27143b59c6904046f6be83ad6fe145d819944f9abbd7247ea9c57848d1d2c678ea8265598a156fe8aeef31d24d958bf6cfa0c2eb3afef40bdae2c5e98d73d0ee - ◉ 0e8aee02e24230c99d6d90d469c582a60fdb2ae8329341bbdb09f4a0beceba1ce7c84fc9ba6c7657d6d275b392b89b825502475ad2501be1ddebd4a09b07668c + @ 6ac4339ad6999058dd1806653ec37fc0091c1cc17419c750fddc5e8c1a6a77829e6dd70b3408403fb2c0b9839cf6bfd1c270f980674f7f89d4d78dc54082a8ef + ◉ 1b0049c19762e43499f2499a45afc9f72b3004d75a2863d41d8867cfafb9bbc8e16aa447107e460d58a5c1462429f032d806f7487836c66c6f351df45746c218 ◉ 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 "###); insta::assert_snapshot!( render(r#"separate(" ", id.short(5), current_operation, user, time.start(), time.end(), time.duration()) ++ "\n""#), @r###" - @ 27143 true test-username@host.example.com 2001-02-03 04:05:07.000 +07:00 2001-02-03 04:05:07.000 +07:00 less than a microsecond - ◉ 0e8ae false test-username@host.example.com 2001-02-03 04:05:07.000 +07:00 2001-02-03 04:05:07.000 +07:00 less than a microsecond + @ 6ac43 true test-username@host.example.com 2001-02-03 04:05:07.000 +07:00 2001-02-03 04:05:07.000 +07:00 less than a microsecond + ◉ 1b004 false test-username@host.example.com 2001-02-03 04:05:07.000 +07:00 2001-02-03 04:05:07.000 +07:00 less than a microsecond ◉ 00000 false @ 1970-01-01 00:00:00.000 +00:00 1970-01-01 00:00:00.000 +00:00 less than a microsecond "###); @@ -183,9 +183,9 @@ fn test_op_log_template() { let regex = Regex::new(r"\d\d years").unwrap(); let stdout = test_env.jj_cmd_success(&repo_path, &["op", "log"]); insta::assert_snapshot!(regex.replace_all(&stdout, "NN years"), @r###" - @ 27143b59c690 test-username@host.example.com NN years ago, lasted less than a microsecond + @ 6ac4339ad699 test-username@host.example.com NN years ago, lasted less than a microsecond │ add workspace 'default' - ◉ 0e8aee02e242 test-username@host.example.com NN years ago, lasted less than a microsecond + ◉ 1b0049c19762 test-username@host.example.com NN years ago, lasted less than a microsecond │ initialize repo ◉ 000000000000 root() "###); @@ -200,25 +200,25 @@ fn test_op_log_builtin_templates() { test_env.jj_cmd_ok(&repo_path, &["describe", "-m", "description 0"]); insta::assert_snapshot!(render(r#"builtin_op_log_compact"#), @r###" - @ 826c45dd2457 test-username@host.example.com 2001-02-03 04:05:08.000 +07:00 - 2001-02-03 04:05:08.000 +07:00 + @ c12bcc2a82e7 test-username@host.example.com 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 'description 0' - ◉ 27143b59c690 test-username@host.example.com 2001-02-03 04:05:07.000 +07:00 - 2001-02-03 04:05:07.000 +07:00 + ◉ 6ac4339ad699 test-username@host.example.com 2001-02-03 04:05:07.000 +07:00 - 2001-02-03 04:05:07.000 +07:00 │ add workspace 'default' - ◉ 0e8aee02e242 test-username@host.example.com 2001-02-03 04:05:07.000 +07:00 - 2001-02-03 04:05:07.000 +07:00 + ◉ 1b0049c19762 test-username@host.example.com 2001-02-03 04:05:07.000 +07:00 - 2001-02-03 04:05:07.000 +07:00 │ initialize repo ◉ 000000000000 root() "###); insta::assert_snapshot!(render(r#"builtin_op_log_comfortable"#), @r###" - @ 826c45dd2457 test-username@host.example.com 2001-02-03 04:05:08.000 +07:00 - 2001-02-03 04:05:08.000 +07:00 + @ c12bcc2a82e7 test-username@host.example.com 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 'description 0' │ - ◉ 27143b59c690 test-username@host.example.com 2001-02-03 04:05:07.000 +07:00 - 2001-02-03 04:05:07.000 +07:00 + ◉ 6ac4339ad699 test-username@host.example.com 2001-02-03 04:05:07.000 +07:00 - 2001-02-03 04:05:07.000 +07:00 │ add workspace 'default' │ - ◉ 0e8aee02e242 test-username@host.example.com 2001-02-03 04:05:07.000 +07:00 - 2001-02-03 04:05:07.000 +07:00 + ◉ 1b0049c19762 test-username@host.example.com 2001-02-03 04:05:07.000 +07:00 - 2001-02-03 04:05:07.000 +07:00 │ initialize repo │ ◉ 000000000000 root() @@ -246,19 +246,19 @@ fn test_op_log_word_wrap() { // ui.log-word-wrap option works insta::assert_snapshot!(render(&["op", "log"], 40, false), @r###" - @ 27143b59c690 test-username@host.example.com 2001-02-03 04:05:07.000 +07:00 - 2001-02-03 04:05:07.000 +07:00 + @ 6ac4339ad699 test-username@host.example.com 2001-02-03 04:05:07.000 +07:00 - 2001-02-03 04:05:07.000 +07:00 │ add workspace 'default' - ◉ 0e8aee02e242 test-username@host.example.com 2001-02-03 04:05:07.000 +07:00 - 2001-02-03 04:05:07.000 +07:00 + ◉ 1b0049c19762 test-username@host.example.com 2001-02-03 04:05:07.000 +07:00 - 2001-02-03 04:05:07.000 +07:00 │ initialize repo ◉ 000000000000 root() "###); insta::assert_snapshot!(render(&["op", "log"], 40, true), @r###" - @ 27143b59c690 + @ 6ac4339ad699 │ test-username@host.example.com │ 2001-02-03 04:05:07.000 +07:00 - │ 2001-02-03 04:05:07.000 +07:00 │ add workspace 'default' - ◉ 0e8aee02e242 + ◉ 1b0049c19762 │ test-username@host.example.com │ 2001-02-03 04:05:07.000 +07:00 - │ 2001-02-03 04:05:07.000 +07:00 @@ -296,15 +296,15 @@ fn test_op_abandon_ancestors() { test_env.jj_cmd_ok(&repo_path, &["commit", "-m", "commit 1"]); test_env.jj_cmd_ok(&repo_path, &["commit", "-m", "commit 2"]); insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["op", "log"]), @r###" - @ 85137561ef60 test-username@host.example.com 2001-02-03 04:05:09.000 +07:00 - 2001-02-03 04:05:09.000 +07:00 + @ d4553a89325a test-username@host.example.com 2001-02-03 04:05:09.000 +07:00 - 2001-02-03 04:05:09.000 +07:00 │ commit a8ac27b29a157ae7dabc0deb524df68823505730 │ args: jj commit -m 'commit 2' - ◉ db27d55e457f test-username@host.example.com 2001-02-03 04:05:08.000 +07:00 - 2001-02-03 04:05:08.000 +07:00 + ◉ de5974401ad4 test-username@host.example.com 2001-02-03 04:05:08.000 +07:00 - 2001-02-03 04:05:08.000 +07:00 │ commit 230dd059e1b059aefc0da06a2e5a7dbf22362f22 │ args: jj commit -m 'commit 1' - ◉ 27143b59c690 test-username@host.example.com 2001-02-03 04:05:07.000 +07:00 - 2001-02-03 04:05:07.000 +07:00 + ◉ 6ac4339ad699 test-username@host.example.com 2001-02-03 04:05:07.000 +07:00 - 2001-02-03 04:05:07.000 +07:00 │ add workspace 'default' - ◉ 0e8aee02e242 test-username@host.example.com 2001-02-03 04:05:07.000 +07:00 - 2001-02-03 04:05:07.000 +07:00 + ◉ 1b0049c19762 test-username@host.example.com 2001-02-03 04:05:07.000 +07:00 - 2001-02-03 04:05:07.000 +07:00 │ initialize repo ◉ 000000000000 root() "###); @@ -316,11 +316,11 @@ fn test_op_abandon_ancestors() { "###); insta::assert_snapshot!( test_env.jj_cmd_success(&repo_path, &["debug", "workingcopy", "--ignore-working-copy"]), @r###" - Current operation: OperationId("1c88fada5b95d13ca136baa13c4b4aae1b79f3d453fe2f56539dbcd5d779642439314a15f685d6737eb414fffb3e53519f65f1d5cc5947a7821331137f4a91e2") + Current operation: OperationId("8d45b00ca36ad7cf1e50ed595eb1ddf744765ada1e1b11c44544666b1fa11eedb41bb925886894bc6a49332c86299b70cf4c486143935965ef1958d7fc17257b") Current tree: Legacy(TreeId("4b825dc642cb6eb9a060e54bf8d69288fbee4904")) "###); insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["op", "log"]), @r###" - @ 1c88fada5b95 test-username@host.example.com 2001-02-03 04:05:09.000 +07:00 - 2001-02-03 04:05:09.000 +07:00 + @ 8d45b00ca36a test-username@host.example.com 2001-02-03 04:05:09.000 +07:00 - 2001-02-03 04:05:09.000 +07:00 │ commit a8ac27b29a157ae7dabc0deb524df68823505730 │ args: jj commit -m 'commit 2' ◉ 000000000000 root() @@ -335,10 +335,10 @@ fn test_op_abandon_ancestors() { Abandoned 2 operations and reparented 1 descendant operations. "###); insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["op", "log"]), @r###" - @ 459e01910446 test-username@host.example.com 2001-02-03 04:05:16.000 +07:00 - 2001-02-03 04:05:16.000 +07:00 + @ 49a67606c2ea test-username@host.example.com 2001-02-03 04:05:16.000 +07:00 - 2001-02-03 04:05:16.000 +07:00 │ commit e184d62c9ab118b0f62de91959b857550a9273a5 │ args: jj commit -m 'commit 5' - ◉ 1c88fada5b95 test-username@host.example.com 2001-02-03 04:05:09.000 +07:00 - 2001-02-03 04:05:09.000 +07:00 + ◉ 8d45b00ca36a test-username@host.example.com 2001-02-03 04:05:09.000 +07:00 - 2001-02-03 04:05:09.000 +07:00 │ commit a8ac27b29a157ae7dabc0deb524df68823505730 │ args: jj commit -m 'commit 2' ◉ 000000000000 root() @@ -365,14 +365,14 @@ fn test_op_abandon_ancestors() { "###); insta::assert_snapshot!( test_env.jj_cmd_success(&repo_path, &["debug", "workingcopy", "--ignore-working-copy"]), @r###" - Current operation: OperationId("dbe91445f72184c82b2ad4c13063a20a764dd5a3bab42fc22652a0ca5d9f5a811d2b051560ca8b45c31f29e9d17ea408b224f761165b30f6df5f68ca74c90435") + Current operation: OperationId("3579f60625d3fc2768dd156488df7ccae6c0076de6ce66cfd02a951de182ac0652bad67c4c5e1f30a3369da8910f3c7cbaef1b5c2781d7c43da2a4404ab470fc") Current tree: Legacy(TreeId("4b825dc642cb6eb9a060e54bf8d69288fbee4904")) "###); insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["op", "log"]), @r###" - @ dbe91445f721 test-username@host.example.com 2001-02-03 04:05:21.000 +07:00 - 2001-02-03 04:05:21.000 +07:00 - │ undo operation 459e01910446fb8f6f6447112abc2227cb3b054b7831eca45bd527145719152931b1707d299f5e4e8484352e67d3622265a0baa58bfa01c459fd753f58791e0d + @ 3579f60625d3 test-username@host.example.com 2001-02-03 04:05:21.000 +07:00 - 2001-02-03 04:05:21.000 +07:00 + │ undo operation 49a67606c2eacaa4af83229c46652c7d5b5c36abdc5f6480baeb7331a19f418f267911410491f558c3f88345f83540ee5a04eb4e8b818dd662a9f419b5eb8f66 │ args: jj undo - ◉ 1c88fada5b95 test-username@host.example.com 2001-02-03 04:05:09.000 +07:00 - 2001-02-03 04:05:09.000 +07:00 + ◉ 8d45b00ca36a test-username@host.example.com 2001-02-03 04:05:09.000 +07:00 - 2001-02-03 04:05:09.000 +07:00 │ commit a8ac27b29a157ae7dabc0deb524df68823505730 │ args: jj commit -m 'commit 2' ◉ 000000000000 root() @@ -384,8 +384,8 @@ fn test_op_abandon_ancestors() { Nothing changed. "###); insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["op", "log", "-l1"]), @r###" - @ dbe91445f721 test-username@host.example.com 2001-02-03 04:05:21.000 +07:00 - 2001-02-03 04:05:21.000 +07:00 - │ undo operation 459e01910446fb8f6f6447112abc2227cb3b054b7831eca45bd527145719152931b1707d299f5e4e8484352e67d3622265a0baa58bfa01c459fd753f58791e0d + @ 3579f60625d3 test-username@host.example.com 2001-02-03 04:05:21.000 +07:00 - 2001-02-03 04:05:21.000 +07:00 + │ undo operation 49a67606c2eacaa4af83229c46652c7d5b5c36abdc5f6480baeb7331a19f418f267911410491f558c3f88345f83540ee5a04eb4e8b818dd662a9f419b5eb8f66 │ args: jj undo "###); } @@ -410,12 +410,12 @@ fn test_op_abandon_without_updating_working_copy() { "###); insta::assert_snapshot!( test_env.jj_cmd_success(&repo_path, &["debug", "workingcopy", "--ignore-working-copy"]), @r###" - Current operation: OperationId("0229bff5a5244b0804cc677c77e318887b6d00422257de108158ef41fa5edcff38aa1683a3c00364835e0565b841eb41c5092300ec23a1aa5e393914d18fef32") + Current operation: OperationId("880aaeffd50eb8682cd132b6d4a449a79c988ce8ff53fa50dd5b22849c8569ca345e313cd7f52b350d4b08e1567d39a556dbc437c24edbfccc9af23764e9b766") Current tree: Legacy(TreeId("4b825dc642cb6eb9a060e54bf8d69288fbee4904")) "###); insta::assert_snapshot!( test_env.jj_cmd_success(&repo_path, &["op", "log", "-l1", "--ignore-working-copy"]), @r###" - @ 0173d6fbe6a2 test-username@host.example.com 2001-02-03 04:05:10.000 +07:00 - 2001-02-03 04:05:10.000 +07:00 + @ d4f54739fcd7 test-username@host.example.com 2001-02-03 04:05:10.000 +07:00 - 2001-02-03 04:05:10.000 +07:00 │ commit 268f5f16139313ff25bef31280b2ec2e675200f3 │ args: jj commit -m 'commit 3' "###); @@ -426,16 +426,16 @@ fn test_op_abandon_without_updating_working_copy() { let (_stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["op", "abandon", "@-"]); insta::assert_snapshot!(stderr, @r###" Abandoned 1 operations and reparented 1 descendant operations. - The working copy operation 0229bff5a524 is not updated because it differs from the repo 0173d6fbe6a2. + The working copy operation 880aaeffd50e is not updated because it differs from the repo d4f54739fcd7. "###); insta::assert_snapshot!( test_env.jj_cmd_success(&repo_path, &["debug", "workingcopy", "--ignore-working-copy"]), @r###" - Current operation: OperationId("0229bff5a5244b0804cc677c77e318887b6d00422257de108158ef41fa5edcff38aa1683a3c00364835e0565b841eb41c5092300ec23a1aa5e393914d18fef32") + Current operation: OperationId("880aaeffd50eb8682cd132b6d4a449a79c988ce8ff53fa50dd5b22849c8569ca345e313cd7f52b350d4b08e1567d39a556dbc437c24edbfccc9af23764e9b766") Current tree: Legacy(TreeId("4b825dc642cb6eb9a060e54bf8d69288fbee4904")) "###); insta::assert_snapshot!( test_env.jj_cmd_success(&repo_path, &["op", "log", "-l1", "--ignore-working-copy"]), @r###" - @ b66dc21d579b test-username@host.example.com 2001-02-03 04:05:10.000 +07:00 - 2001-02-03 04:05:10.000 +07:00 + @ 1b403259869c test-username@host.example.com 2001-02-03 04:05:10.000 +07:00 - 2001-02-03 04:05:10.000 +07:00 │ commit 268f5f16139313ff25bef31280b2ec2e675200f3 │ args: jj commit -m 'commit 3' "###); diff --git a/cli/tests/test_util_command.rs b/cli/tests/test_util_command.rs index 93b3c664a..251f216f1 100644 --- a/cli/tests/test_util_command.rs +++ b/cli/tests/test_util_command.rs @@ -89,6 +89,6 @@ fn test_gc_operation_log() { // Now this doesn't work. let stderr = test_env.jj_cmd_failure(&repo_path, &["debug", "operation", &op_to_remove]); insta::assert_snapshot!(stderr, @r###" - Error: No operation ID matching "35688918195690874cbf1f282140cda33c882e48a84dbb0f92c262b52ace4a5753777432b18e9de01bc23121b23261eb2c828622836b9ec7ded7c0ca3c7c1670" + Error: No operation ID matching "f9400b5274c6f1cfa23afbc1956349897a6975116135a59ab19d941119cc9fad93d9668b8c7d913fbd68c543dcba40a8d44135a53996a9e8ea92d4b78ef52cb6" "###); } diff --git a/cli/tests/test_workspaces.rs b/cli/tests/test_workspaces.rs index 45ae5379c..8e3047df9 100644 --- a/cli/tests/test_workspaces.rs +++ b/cli/tests/test_workspaces.rs @@ -273,14 +273,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 a07b009d6eba). + Error: The working copy is stale (not updated since operation d93fe4c5a6d1). 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 a07b009d6eba). + Error: The working copy is stale (not updated since operation d93fe4c5a6d1). 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. "###); @@ -360,7 +360,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 a07b009d6eba). + Error: The working copy is stale (not updated since operation d93fe4c5a6d1). 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. "###); @@ -412,13 +412,13 @@ fn test_workspaces_current_op_discarded_by_other() { ], ); insta::assert_snapshot!(stdout, @r###" - @ 6c22dbc43c abandon commit 479653b3216ad2af6a8ffcbe5885203b7bb3d0d49175ffd2be58a454da95493b0e8e44885ac4f7caacbeb79b407c66d68991f5a01666e976687c6732b3311780 - ◉ 72b8975c75 Create initial working-copy commit in workspace secondary - ◉ b816f120a4 add workspace 'secondary' - ◉ 332e901b2a new empty commit - ◉ c07b7d7796 snapshot working copy - ◉ c5295044c8 add workspace 'default' - ◉ 0c73edb541 initialize repo + @ 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 + ◉ d0bd64e0b3 add workspace 'default' + ◉ 06a74719e6 initialize repo ◉ 0000000000 "###); @@ -427,8 +427,8 @@ fn test_workspaces_current_op_discarded_by_other() { test_env.jj_cmd_ok(&main_path, &["util", "gc", "--expire=now"]); insta::assert_snapshot!(get_log_output(&test_env, &main_path), @r###" - @ 3bebcd0f8335f735c00063290247d6c3332106261d0dd4810105906cdf29878990ee717690750ec203a7c4763a36968a0d9de799f46bc37fcf62dde13a52b73f default@ - │ ◉ 1d558d136f4d90ec2fe9beac8eb638eb509d0e378c4546f7b2634f93d0c86cfdd08b7efe4fd3aeb383f41fb7ebb2311a14754f617e71389c3aa9519c05c17dd8 secondary@ + @ 6dc8f254cd3cbe5c086fb99adc66724303d7ceb12790e585e5946940dffca60dbb928b852e3c309b20dee351df5897f49b83c89d583a756fd736772b3e5f206a default@ + │ ◉ 4278b78fb503846224c4328785f8557558aab32b1e3d6ad6b343e94575dd5c67492acea9aa1c417817b4943e78547877e031208a51f8eadcd1ac55d6ebe77983 secondary@ ├─╯ ◉ 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 "###); @@ -442,15 +442,15 @@ 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 72b8975c7573303a258c292ad69f93dad1922532a2839000c217102da736ed7c6235872bdfa8c747a723df78547666686722d0d301da2d70d815798634c8eedc of type operation not found - Created and checked out recovery commit 84e67dd875e0 + Failed to read working copy's current operation; attempting recovery. Error message from read attempt: Object d8304661a23b0d8b9ecc517a465869d7c8b6563b460f029541fbe5246cc02718145c5ad8f7fed26863b46a68e79d609b878a7ea5a239baf530858e86e81e72d1 of type operation not found + Created and checked out recovery commit 9d040f9a433c "###); insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(get_log_output(&test_env, &main_path), @r###" - ◉ be7e513bfb77cde552e363f947ecc5757557d0d24caf5c627eb9631f38215334722c31b4266c3627111210b1c5eb00f4cd7af4299510cb8c2fe39b405d31b45b secondary@ - ◉ 1d558d136f4d90ec2fe9beac8eb638eb509d0e378c4546f7b2634f93d0c86cfdd08b7efe4fd3aeb383f41fb7ebb2311a14754f617e71389c3aa9519c05c17dd8 - │ @ 3bebcd0f8335f735c00063290247d6c3332106261d0dd4810105906cdf29878990ee717690750ec203a7c4763a36968a0d9de799f46bc37fcf62dde13a52b73f default@ + ◉ e5b7d155229f587a96678aaa23b771c694f5bb8ad690e1312b90dd3c73b01ab26ea0a2946aa2760f3c672f1587f2742718a6596c46c3a3b881122906164c081a secondary@ + ◉ 4278b78fb503846224c4328785f8557558aab32b1e3d6ad6b343e94575dd5c67492acea9aa1c417817b4943e78547877e031208a51f8eadcd1ac55d6ebe77983 + │ @ 6dc8f254cd3cbe5c086fb99adc66724303d7ceb12790e585e5946940dffca60dbb928b852e3c309b20dee351df5897f49b83c89d583a756fd736772b3e5f206a default@ ├─╯ ◉ 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 "###); @@ -460,16 +460,16 @@ fn test_workspaces_current_op_discarded_by_other() { insta::assert_snapshot!(stdout, @r###" Working copy changes: A file - Working copy : znkkpsqq be7e513b (no description set) - Parent commit: pmmvwywv 1d558d13 (empty) (no description set) + Working copy : znkkpsqq e5b7d155 (no description set) + Parent commit: pmmvwywv 4278b78f (empty) (no description set) "###); let (stdout, stderr) = test_env.jj_cmd_ok(&secondary_path, &["obslog"]); insta::assert_snapshot!(stderr, @""); insta::assert_snapshot!(stdout, @r###" - @ znkkpsqq test.user@example.com 2001-02-03 04:05:16.000 +07:00 secondary@ be7e513b + @ znkkpsqq test.user@example.com 2001-02-03 04:05:16.000 +07:00 secondary@ e5b7d155 │ (no description set) - ◉ znkkpsqq hidden test.user@example.com 2001-02-03 04:05:16.000 +07:00 84e67dd8 + ◉ znkkpsqq hidden test.user@example.com 2001-02-03 04:05:16.000 +07:00 9d040f9a (empty) (no description set) "###); } @@ -634,7 +634,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###" - @ f96865b00a04 test-username@host.example.com 2001-02-03 04:05:12.000 +07:00 - 2001-02-03 04:05:12.000 +07:00 + @ ea093f0a1a06 test-username@host.example.com 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 "###); diff --git a/lib/src/backend.rs b/lib/src/backend.rs index 76779804b..edc81b318 100644 --- a/lib/src/backend.rs +++ b/lib/src/backend.rs @@ -114,11 +114,11 @@ impl ContentHash for MergedTreeId { fn hash(&self, state: &mut impl digest::Update) { match self { MergedTreeId::Legacy(tree_id) => { - state.update(b"0"); + state.update(&0u32.to_le_bytes()); ContentHash::hash(tree_id, state); } MergedTreeId::Merge(tree_ids) => { - state.update(b"1"); + state.update(&1u32.to_le_bytes()); ContentHash::hash(tree_ids, state); } } diff --git a/lib/src/content_hash.rs b/lib/src/content_hash.rs index 8f5d67a3a..9f9dfc373 100644 --- a/lib/src/content_hash.rs +++ b/lib/src/content_hash.rs @@ -76,9 +76,9 @@ impl ContentHash for String { impl ContentHash for Option { fn hash(&self, state: &mut impl digest::Update) { match self { - None => state.update(&[0]), + None => state.update(&0u32.to_le_bytes()), Some(x) => { - state.update(&[1]); + state.update(&1u32.to_le_bytes()); x.hash(state) } } @@ -227,7 +227,7 @@ mod tests { x: vec![None, Some(42)], y: 17 })), - @"14e42ea3d680bc815d0cea8ac20d3e872120014fb7bba8d82c3ffa7a8e6d63c41ef9631c60b73b150e3dd72efe50e8b0248321fe2b7eea09d879f3757b879372" + @"e33c423b4b774b1353c414e0f9ef108822fde2fd5113fcd53bf7bd9e74e3206690b96af96373f268ed95dd020c7cbe171c7b7a6947fcaf5703ff6c8e208cefd4" ); } diff --git a/lib/src/op_store.rs b/lib/src/op_store.rs index 9b6380d93..750f996a7 100644 --- a/lib/src/op_store.rs +++ b/lib/src/op_store.rs @@ -214,7 +214,10 @@ pub enum RemoteRefState { impl ContentHash for RemoteRefState { fn hash(&self, state: &mut impl digest::Update) { - (*self as u8).hash(state); + match self { + RemoteRefState::New => state.update(&0u32.to_le_bytes()), + RemoteRefState::Tracking => state.update(&1u32.to_le_bytes()), + } } } diff --git a/lib/src/simple_op_store.rs b/lib/src/simple_op_store.rs index 3522bd1e2..405dda93e 100644 --- a/lib/src/simple_op_store.rs +++ b/lib/src/simple_op_store.rs @@ -770,7 +770,7 @@ mod tests { // Test exact output so we detect regressions in compatibility assert_snapshot!( ViewId::new(blake2b_hash(&create_view()).to_vec()).hex(), - @"19af495b5a828c38e933c518a53eb9f7fb7129348a0950d7971b86adf7eb25a13bf45c7f358da1776b27fe6f4bc9134787389d976b768e46ac6cef56bc20c083" + @"f426676b3a2f7c6b9ec8677cb05ed249d0d244ab7e86a7c51117e2d8a4829db65e55970c761231e2107d303bf3d33a1f2afdd4ed2181f223e99753674b20a35e" ); } diff --git a/lib/tests/test_operations.rs b/lib/tests/test_operations.rs index 9fe7596b0..c66c567c3 100644 --- a/lib/tests/test_operations.rs +++ b/lib/tests/test_operations.rs @@ -437,21 +437,23 @@ fn test_resolve_op_id() { let op_store = repo.op_store(); let mut operations = Vec::new(); - for i in (0..6).chain([16]) { + // The actual value of `i` doesn't matter, we just need to make sure we end + // up with hashes with ambiguous prefixes. + for i in (1..7).chain([16]) { let tx = repo.start_transaction(&settings); let repo = tx.commit(format!("transaction {i}")); operations.push(repo.operation().clone()); } - // "c" and "0" are ambiguous + // "6" and "0" are ambiguous insta::assert_debug_snapshot!(operations.iter().map(|op| op.id().hex()).collect_vec(), @r###" [ - "4ff2007de55a2f649f7ab0c98618e4126ef49f0d40a086c8e0a4612a0d5ab4992e1baf4b4fa0a2a224fab39fc5e5b200ac4cddf964db29c6be1379ab2b6d4572", - "c9fb43476d60aad9f44d13e7789377e0cf585e62f905e78eab815361ed96a0c5905508e868cea79e0c3df2ef3778bf1f812d8379a4e5ae91d7ba39d875594bb1", - "7556549ffe31d303a9cb99974a11fb56aca05726c608564368648503e5edcc95d505e55323b086cb7a731972efc9094256548f745bfd9d886407c42a5f894d26", - "cdb35f2826be9a561ae452f06a86e020feec43419d38406f731190732fe143bd69b0e8496ee23817ce13ff6abf9202ec3279b9cb21222be89d5592faa779ff6c", - "19971a76da2927c916c079813a0e1e8d91fab52065f926018973b6b5e9d0a22cfdefe3d937ed3ec8e323074a50f6e747a2d6cee0e95185980594ffda8c438a84", - "689a23c147a58d70a6f30005d64e49e68fe96a2e9143d78b5957bf26fd9cf06d218279430d7c87b6c5ba163f1557fe2f3b951f0ad126bbe1b804e992c590616a", - "09baae9e4e6aeaa9a6107ec4b2a6e86350dbefc227d962983a32631e8f9c65a5cdd73a7420f79eb139ee10f01cf9fcab579abc4596f1844499fdeed75a382db6", + "661239681c88dd0e8037ac010df3917e4fb1b36fdad0586fea09718741552c8d26684821043d5f9423fc618220f7826b2b8d77c13566733e7d591605d0850d0e", + "22d5aeb8f2fdda8a782fc589c891b1eea0a73c6685db45d1c7eda5d5c02b99a8679743deb2508a643bb074884363e54cc3ea41a06ec380de3b2c536a5c1ae98f", + "3580c377da0dfea738a735777fe3d00569fcf484b0ec4080a337e38d1e008098ed87d50f7c2dad476b828871259d055cec05116cd0a02e323477aeb7df5473e4", + "b09c135f3d36357a29246ee3dc86e008ef227186104a2e99524abe601a7bfa8b898a585e9d2b3cbf5131e72043edf0a219ee192bd4a3bff8d6cfc44239a4c206", + "820bb7cdbdda7206902391e6b8b08df719156ca9b3eb008a723da6e15cf4056987ac36f42e075a9491ed95dde158925f65c42027700b6bce52ce6f67d69980ee", + "08f1e27b776f7709f4a288129758d0104cb0230dc68f3edb8a1227c7b715f36c4079ba19bccb819d4f45e840e19e321e807a89900eeca77da0cad6b5549e3691", + "695435d5ab08eaf979d262c01365d9b9c06097a8ba5a9cea530042528d50000d99627633262467d3099ed73617a0bc21f7796376432989174635365798d73a3d", ] "###); @@ -472,7 +474,7 @@ fn test_resolve_op_id() { ); // Ambiguous id assert_matches!( - resolve("c"), + resolve("6"), Err(OpsetEvaluationError::OpsetResolution( OpsetResolutionError::AmbiguousIdPrefix(_) )) @@ -499,7 +501,7 @@ fn test_resolve_op_id() { }; assert_eq!(resolve(&root_operation.id().hex()).unwrap(), root_operation); assert_eq!(resolve("00").unwrap(), root_operation); - assert_eq!(resolve("09").unwrap(), operations[6]); + assert_eq!(resolve("69").unwrap(), operations[6]); assert_matches!( resolve("0"), Err(OpsetEvaluationError::OpsetResolution(