diff --git a/demos/demo_juggle_conflicts.sh b/demos/demo_juggle_conflicts.sh index 1995083b2..3bd6e32a0 100755 --- a/demos/demo_juggle_conflicts.sh +++ b/demos/demo_juggle_conflicts.sh @@ -6,13 +6,13 @@ new_tmp_dir jj init echo "first" > file jj branch create first -jj close -m 'first' +jj commit -m 'first' echo "second" > file jj branch create second -jj close -m 'second' +jj commit -m 'second' echo "third" > file jj branch create third -jj close -m 'third' +jj commit -m 'third' comment "We are in a repo with three commits, all editing the same line:" diff --git a/tests/test_edit_command.rs b/tests/test_edit_command.rs index 15cc4bad0..d1330583b 100644 --- a/tests/test_edit_command.rs +++ b/tests/test_edit_command.rs @@ -24,7 +24,7 @@ fn test_edit() { test_env.jj_cmd_success(test_env.env_root(), &["init", "repo", "--git"]); let repo_path = test_env.env_root().join("repo"); std::fs::write(repo_path.join("file1"), "0").unwrap(); - test_env.jj_cmd_success(&repo_path, &["close", "-m", "first"]); + test_env.jj_cmd_success(&repo_path, &["commit", "-m", "first"]); test_env.jj_cmd_success(&repo_path, &["describe", "-m", "second"]); std::fs::write(repo_path.join("file1"), "1").unwrap(); diff --git a/tests/test_git_colocated.rs b/tests/test_git_colocated.rs index d792aeb2f..50b85a692 100644 --- a/tests/test_git_colocated.rs +++ b/tests/test_git_colocated.rs @@ -25,7 +25,7 @@ fn test_git_colocated() { // Create a commit from jj and check that it's reflected in git std::fs::write(workspace_root.join("new-file"), "contents").unwrap(); - test_env.jj_cmd_success(&workspace_root, &["close", "-m", "add a file"]); + test_env.jj_cmd_success(&workspace_root, &["commit", "-m", "add a file"]); let stdout = test_env.jj_cmd_success(&workspace_root, &["log", "-T", "commit_id \" \" branches"]); insta::assert_snapshot!(stdout, @r###" @@ -48,10 +48,10 @@ fn test_git_colocated_rebase_on_import() { // Make some changes in jj and check that they're reflected in git std::fs::write(workspace_root.join("file"), "contents").unwrap(); - test_env.jj_cmd_success(&workspace_root, &["close", "-m", "add a file"]); + test_env.jj_cmd_success(&workspace_root, &["commit", "-m", "add a file"]); std::fs::write(workspace_root.join("file"), "modified").unwrap(); test_env.jj_cmd_success(&workspace_root, &["branch", "set", "master"]); - test_env.jj_cmd_success(&workspace_root, &["close", "-m", "modify a file"]); + test_env.jj_cmd_success(&workspace_root, &["commit", "-m", "modify a file"]); // TODO: We shouldn't need this command here to trigger an import of the // refs/heads/master we just exported test_env.jj_cmd_success(&workspace_root, &["st"]); diff --git a/tests/test_git_push.rs b/tests/test_git_push.rs index becc2b923..90b8976ab 100644 --- a/tests/test_git_push.rs +++ b/tests/test_git_push.rs @@ -198,13 +198,13 @@ fn test_git_push_unsnapshotted_change() { fn test_git_push_conflict() { let (test_env, workspace_root) = set_up(); std::fs::write(workspace_root.join("file"), "first").unwrap(); - test_env.jj_cmd_success(&workspace_root, &["close", "-m", "first"]); + test_env.jj_cmd_success(&workspace_root, &["commit", "-m", "first"]); std::fs::write(workspace_root.join("file"), "second").unwrap(); - test_env.jj_cmd_success(&workspace_root, &["close", "-m", "second"]); + test_env.jj_cmd_success(&workspace_root, &["commit", "-m", "second"]); std::fs::write(workspace_root.join("file"), "third").unwrap(); test_env.jj_cmd_success(&workspace_root, &["rebase", "-r", "@", "-d", "@--"]); test_env.jj_cmd_success(&workspace_root, &["branch", "set", "my-branch"]); - test_env.jj_cmd_success(&workspace_root, &["close", "-m", "third"]); + test_env.jj_cmd_success(&workspace_root, &["describe", "-m", "third"]); let stderr = test_env.jj_cmd_failure(&workspace_root, &["git", "push", "--all"]); insta::assert_snapshot!(stderr, @r###" Error: Won't push commit 50ccff1aeab0 since it has conflicts @@ -215,11 +215,11 @@ fn test_git_push_conflict() { fn test_git_push_no_description() { let (test_env, workspace_root) = set_up(); test_env.jj_cmd_success(&workspace_root, &["branch", "create", "my-branch"]); - test_env.jj_cmd_success(&workspace_root, &["close", "-m", ""]); + test_env.jj_cmd_success(&workspace_root, &["describe", "-m="]); let stderr = test_env.jj_cmd_failure(&workspace_root, &["git", "push", "--branch", "my-branch"]); insta::assert_snapshot!(stderr, @r###" - Error: Won't push commit 4e5f01c842af since it has no description + Error: Won't push commit 230dd059e1b0 since it has no description "###); } @@ -233,25 +233,21 @@ fn test_git_push_missing_author() { .assert() .success(); }; - run_without_var("JJ_USER", &["checkout", "root"]); + run_without_var("JJ_USER", &["checkout", "root", "-m=initial"]); run_without_var("JJ_USER", &["branch", "create", "missing-name"]); - run_without_var("JJ_USER", &["close", "-m", "initial"]); let stderr = test_env.jj_cmd_failure( &workspace_root, &["git", "push", "--branch", "missing-name"], ); insta::assert_snapshot!(stderr, @r###" - Error: Won't push commit 567e1ab3da0e since it has no author and/or committer set + Error: Won't push commit 91a20b396803 since it has no author and/or committer set "###); - run_without_var("JJ_EMAIL", &["checkout", "root"]); + run_without_var("JJ_EMAIL", &["checkout", "root", "-m=initial"]); run_without_var("JJ_EMAIL", &["branch", "create", "missing-email"]); - run_without_var("JJ_EMAIL", &["close", "-m", "initial"]); - let stderr = test_env.jj_cmd_failure( - &workspace_root, - &["git", "push", "--branch", "missing-email"], - ); + let stderr = + test_env.jj_cmd_failure(&workspace_root, &["git", "push", "--branch=missing-email"]); insta::assert_snapshot!(stderr, @r###" - Error: Won't push commit ce7b456bb11a since it has no author and/or committer set + Error: Won't push commit 7186423bd158 since it has no author and/or committer set "###); } @@ -266,32 +262,26 @@ fn test_git_push_missing_committer() { .success(); }; test_env.jj_cmd_success(&workspace_root, &["branch", "create", "missing-name"]); - run_without_var("JJ_USER", &["close", "-m", "no committer name"]); - let stderr = test_env.jj_cmd_failure( - &workspace_root, - &["git", "push", "--branch", "missing-name"], - ); + run_without_var("JJ_USER", &["describe", "-m=no committer name"]); + let stderr = + test_env.jj_cmd_failure(&workspace_root, &["git", "push", "--branch=missing-name"]); insta::assert_snapshot!(stderr, @r###" Error: Won't push commit df8d9f6cf625 since it has no author and/or committer set "###); test_env.jj_cmd_success(&workspace_root, &["checkout", "root"]); test_env.jj_cmd_success(&workspace_root, &["branch", "create", "missing-email"]); - run_without_var("JJ_EMAIL", &["close", "-m", "no committer email"]); - let stderr = test_env.jj_cmd_failure( - &workspace_root, - &["git", "push", "--branch", "missing-email"], - ); + run_without_var("JJ_EMAIL", &["describe", "-m=no committer email"]); + let stderr = + test_env.jj_cmd_failure(&workspace_root, &["git", "push", "--branch=missing-email"]); insta::assert_snapshot!(stderr, @r###" Error: Won't push commit 61b8a14387d7 since it has no author and/or committer set "###); // Test message when there are multiple reasons (missing committer and // description) - run_without_var("JJ_EMAIL", &["describe", "-m", "", "missing-email"]); - let stderr = test_env.jj_cmd_failure( - &workspace_root, - &["git", "push", "--branch", "missing-email"], - ); + run_without_var("JJ_EMAIL", &["describe", "-m=", "missing-email"]); + let stderr = + test_env.jj_cmd_failure(&workspace_root, &["git", "push", "--branch=missing-email"]); insta::assert_snapshot!(stderr, @r###" Error: Won't push commit 9e1aae45b6a3 since it has no description and it has no author and/or committer set "###); diff --git a/tests/test_workspaces.rs b/tests/test_workspaces.rs index 06aa70ce6..dc5db0ea7 100644 --- a/tests/test_workspaces.rs +++ b/tests/test_workspaces.rs @@ -29,7 +29,7 @@ fn test_workspaces_add_second_workspace() { let secondary_path = test_env.env_root().join("secondary"); std::fs::write(main_path.join("file"), "contents").unwrap(); - test_env.jj_cmd_success(&main_path, &["close", "-m", "initial"]); + test_env.jj_cmd_success(&main_path, &["commit", "-m", "initial"]); let stdout = test_env.jj_cmd_success(&main_path, &["workspace", "list"]); insta::assert_snapshot!(stdout, @r###" @@ -81,15 +81,15 @@ fn test_workspaces_conflicting_edits() { let secondary_path = test_env.env_root().join("secondary"); std::fs::write(main_path.join("file"), "contents\n").unwrap(); - test_env.jj_cmd_success(&main_path, &["close", "-m", "initial"]); + test_env.jj_cmd_success(&main_path, &["new"]); test_env.jj_cmd_success(&main_path, &["workspace", "add", "../secondary"]); insta::assert_snapshot!(get_log_output(&test_env, &main_path), @r###" - o 6bafff1a880f313aebb6d357c79b7aa4befa0af8 secondary@ - | @ c8f1217f93a0bc570a8bbfe055980f27062339ef default@ + o 265af0cdbcc7bb33e3734ad72565c943ce3fb0d4 secondary@ + | @ 351099fa72cfbb1b34e410e89821efc623295974 default@ |/ - o 5af56dcc2cc27bb234e5574b5a3ebc5f22081462 + o cf911c223d3e24e001fc8264d6dbf0610804fc40 o 0000000000000000000000000000000000000000 "###); @@ -101,15 +101,15 @@ fn test_workspaces_conflicting_edits() { let stdout = test_env.jj_cmd_success(&main_path, &["squash"]); insta::assert_snapshot!(stdout, @r###" Rebased 1 descendant commits - Working copy now at: 86bef7fee095 (no description set) + Working copy now at: fe8f41ed01d6 (no description set) "###); // The secondary workspace's checkout was updated insta::assert_snapshot!(get_log_output(&test_env, &main_path), @r###" - @ 86bef7fee095bb5626d853c222764fc7c9fb88ac default@ - | o 8d8269a323a01a287236c4fd5f64dc9737febb5b secondary@ + @ fe8f41ed01d693b2d4365cd89e42ad9c531a939b default@ + | o a1896a17282f19089a5cec44358d6609910e0513 secondary@ |/ - o 52601f748bf6cb00ad5389922f530f20a7ecffaa + o c0d4a99ef98ada7da8dc73a778bbb747c4178385 o 0000000000000000000000000000000000000000 "###); let stdout = get_log_output(&test_env, &secondary_path); @@ -118,10 +118,10 @@ fn test_workspaces_conflicting_edits() { // have been committed first (causing divergence) assert!(stdout.starts_with("The working copy is stale")); insta::assert_snapshot!(stdout.lines().skip(1).join("\n"), @r###" - o 86bef7fee095bb5626d853c222764fc7c9fb88ac default@ - | @ 8d8269a323a01a287236c4fd5f64dc9737febb5b secondary@ + o fe8f41ed01d693b2d4365cd89e42ad9c531a939b default@ + | @ a1896a17282f19089a5cec44358d6609910e0513 secondary@ |/ - o 52601f748bf6cb00ad5389922f530f20a7ecffaa + o c0d4a99ef98ada7da8dc73a778bbb747c4178385 o 0000000000000000000000000000000000000000 "###); @@ -129,10 +129,10 @@ fn test_workspaces_conflicting_edits() { let stdout = get_log_output(&test_env, &secondary_path); assert!(!stdout.starts_with("The working copy is stale")); insta::assert_snapshot!(stdout, @r###" - o 86bef7fee095bb5626d853c222764fc7c9fb88ac default@ - | @ 8d8269a323a01a287236c4fd5f64dc9737febb5b secondary@ + o fe8f41ed01d693b2d4365cd89e42ad9c531a939b default@ + | @ a1896a17282f19089a5cec44358d6609910e0513 secondary@ |/ - o 52601f748bf6cb00ad5389922f530f20a7ecffaa + o c0d4a99ef98ada7da8dc73a778bbb747c4178385 o 0000000000000000000000000000000000000000 "###); } @@ -145,7 +145,7 @@ fn test_workspaces_forget() { let main_path = test_env.env_root().join("main"); std::fs::write(main_path.join("file"), "contents").unwrap(); - test_env.jj_cmd_success(&main_path, &["close", "-m", "initial"]); + test_env.jj_cmd_success(&main_path, &["new"]); test_env.jj_cmd_success(&main_path, &["workspace", "add", "../secondary"]); let stdout = test_env.jj_cmd_success(&main_path, &["workspace", "forget"]); @@ -154,7 +154,7 @@ fn test_workspaces_forget() { // When listing workspaces, only the secondary workspace shows up let stdout = test_env.jj_cmd_success(&main_path, &["workspace", "list"]); insta::assert_snapshot!(stdout, @r###" - secondary: 39a6d6c6f295 (no description set) + secondary: feda1c4e5ffe (no description set) "###); // `jj status` tells us that there's no working copy here @@ -169,10 +169,10 @@ fn test_workspaces_forget() { // there's only one workspace. We should show it when the command is not run // from that workspace. insta::assert_snapshot!(get_log_output(&test_env, &main_path), @r###" - o 39a6d6c6f29557f886ded65d50063da4321ab2a8 - | o 988d8c1dca7e0944210ccc33584a6a42cd2962d4 + o feda1c4e5ffe63fb16818ccdd8c21483537e31f2 + | o e949be04e93e830fcce23fefac985c1deee52eea |/ - o 2062e7d6f1f46b4fe1453040d691931e77a88f7c + o 123ed18e4c4c0d77428df41112bc02ffc83fb935 o 0000000000000000000000000000000000000000 "###);