git-push: just say "Changes to push to <REMOTE>"

"Bookmark changes" sounds like changes will be bookmarked, and "Bookmark" here
is redundant. If we add support for pushing tags, this message will have to be
generalized anyway.
This commit is contained in:
Yuya Nishihara 2024-09-14 11:47:03 +09:00
parent a48ecf3e62
commit 0c0e1b61e3
4 changed files with 157 additions and 157 deletions

View file

@ -266,7 +266,7 @@ pub fn cmd_git_push(
validate_commits_ready_to_push(&bookmark_updates, &remote, &tx, command, args)?; validate_commits_ready_to_push(&bookmark_updates, &remote, &tx, command, args)?;
if let Some(mut formatter) = ui.status_formatter() { if let Some(mut formatter) = ui.status_formatter() {
writeln!(formatter, "Bookmark changes to push to {remote}:")?; writeln!(formatter, "Changes to push to {remote}:")?;
print_commits_ready_to_push(formatter.as_mut(), repo.as_ref(), &bookmark_updates)?; print_commits_ready_to_push(formatter.as_mut(), repo.as_ref(), &bookmark_updates)?;
} }

View file

@ -88,13 +88,13 @@ fn test_git_private_commits_block_pushing() {
// May push when the commit is removed from git.private-commits // May push when the commit is removed from git.private-commits
test_env.add_config(r#"git.private-commits = "none()""#); test_env.add_config(r#"git.private-commits = "none()""#);
let (_, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push", "--all"]); let (_, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push", "--all"]);
insta::assert_snapshot!(stderr, @r###" insta::assert_snapshot!(stderr, @r#"
Bookmark changes to push to origin: Changes to push to origin:
Move forward bookmark main from 7eb97bf230ad to aa3058ff8663 Move forward bookmark main from 7eb97bf230ad to aa3058ff8663
Warning: The working-copy commit in workspace 'default' became immutable, so a new commit has been created on top of it. Warning: The working-copy commit in workspace 'default' became immutable, so a new commit has been created on top of it.
Working copy now at: znkkpsqq 2e1adf47 (empty) (no description set) Working copy now at: znkkpsqq 2e1adf47 (empty) (no description set)
Parent commit : yqosqzyt aa3058ff main | (empty) private 1 Parent commit : yqosqzyt aa3058ff main | (empty) private 1
"###); "#);
} }
#[test] #[test]
@ -116,13 +116,13 @@ fn test_git_private_commits_can_be_overridden() {
&workspace_root, &workspace_root,
&["git", "push", "--all", "--allow-private"], &["git", "push", "--all", "--allow-private"],
); );
insta::assert_snapshot!(stderr, @r###" insta::assert_snapshot!(stderr, @r#"
Bookmark changes to push to origin: Changes to push to origin:
Move forward bookmark main from 7eb97bf230ad to aa3058ff8663 Move forward bookmark main from 7eb97bf230ad to aa3058ff8663
Warning: The working-copy commit in workspace 'default' became immutable, so a new commit has been created on top of it. Warning: The working-copy commit in workspace 'default' became immutable, so a new commit has been created on top of it.
Working copy now at: znkkpsqq 2e1adf47 (empty) (no description set) Working copy now at: znkkpsqq 2e1adf47 (empty) (no description set)
Parent commit : yqosqzyt aa3058ff main | (empty) private 1 Parent commit : yqosqzyt aa3058ff main | (empty) private 1
"###); "#);
} }
#[test] #[test]
@ -135,13 +135,13 @@ fn test_git_private_commits_are_not_checked_if_immutable() {
test_env.add_config(r#"git.private-commits = "description(glob:'private*')""#); test_env.add_config(r#"git.private-commits = "description(glob:'private*')""#);
test_env.add_config(r#"revset-aliases."immutable_heads()" = "all()""#); test_env.add_config(r#"revset-aliases."immutable_heads()" = "all()""#);
let (_, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push", "--all"]); let (_, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push", "--all"]);
insta::assert_snapshot!(stderr, @r###" insta::assert_snapshot!(stderr, @r#"
Bookmark changes to push to origin: Changes to push to origin:
Move forward bookmark main from 7eb97bf230ad to aa3058ff8663 Move forward bookmark main from 7eb97bf230ad to aa3058ff8663
Warning: The working-copy commit in workspace 'default' became immutable, so a new commit has been created on top of it. Warning: The working-copy commit in workspace 'default' became immutable, so a new commit has been created on top of it.
Working copy now at: yostqsxw dce4a15c (empty) (no description set) Working copy now at: yostqsxw dce4a15c (empty) (no description set)
Parent commit : yqosqzyt aa3058ff main | (empty) private 1 Parent commit : yqosqzyt aa3058ff main | (empty) private 1
"###); "#);
} }
#[test] #[test]
@ -171,10 +171,10 @@ fn test_git_private_commits_descending_from_commits_pushed_do_not_block_pushing(
test_env.add_config(r#"git.private-commits = "description(glob:'private*')""#); test_env.add_config(r#"git.private-commits = "description(glob:'private*')""#);
let (_, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push", "-b=main"]); let (_, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push", "-b=main"]);
insta::assert_snapshot!(stderr, @r###" insta::assert_snapshot!(stderr, @r#"
Bookmark changes to push to origin: Changes to push to origin:
Move forward bookmark main from 7eb97bf230ad to 05ef53bc99ec Move forward bookmark main from 7eb97bf230ad to 05ef53bc99ec
"###); "#);
} }
#[test] #[test]
@ -194,14 +194,14 @@ fn test_git_private_commits_already_on_the_remote_do_not_block_push() {
test_env.jj_cmd_ok(&workspace_root, &["bookmark", "set", "main"]); test_env.jj_cmd_ok(&workspace_root, &["bookmark", "set", "main"]);
let (_, stderr) = let (_, stderr) =
test_env.jj_cmd_ok(&workspace_root, &["git", "push", "-b=main", "-b=bookmark1"]); test_env.jj_cmd_ok(&workspace_root, &["git", "push", "-b=main", "-b=bookmark1"]);
insta::assert_snapshot!(stderr, @r###" insta::assert_snapshot!(stderr, @r#"
Bookmark changes to push to origin: Changes to push to origin:
Move forward bookmark main from 7eb97bf230ad to fbb352762352 Move forward bookmark main from 7eb97bf230ad to fbb352762352
Add bookmark bookmark1 to 7eb97bf230ad Add bookmark bookmark1 to 7eb97bf230ad
Warning: The working-copy commit in workspace 'default' became immutable, so a new commit has been created on top of it. Warning: The working-copy commit in workspace 'default' became immutable, so a new commit has been created on top of it.
Working copy now at: kpqxywon a7b08364 (empty) (no description set) Working copy now at: kpqxywon a7b08364 (empty) (no description set)
Parent commit : yostqsxw fbb35276 main | (empty) public 3 Parent commit : yostqsxw fbb35276 main | (empty) public 3
"###); "#);
test_env.add_config(r#"git.private-commits = "description(glob:'private*')""#); test_env.add_config(r#"git.private-commits = "description(glob:'private*')""#);
@ -211,10 +211,10 @@ fn test_git_private_commits_already_on_the_remote_do_not_block_push() {
&["bookmark", "set", "bookmark1", "-r=main"], &["bookmark", "set", "bookmark1", "-r=main"],
); );
let (_, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push", "--all"]); let (_, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push", "--all"]);
insta::assert_snapshot!(stderr, @r###" insta::assert_snapshot!(stderr, @r#"
Bookmark changes to push to origin: Changes to push to origin:
Move forward bookmark bookmark1 from 7eb97bf230ad to fbb352762352 Move forward bookmark bookmark1 from 7eb97bf230ad to fbb352762352
"###); "#);
// Ensure that the already-pushed commit doesn't block a new bookmark from // Ensure that the already-pushed commit doesn't block a new bookmark from
// being pushed // being pushed
@ -224,10 +224,10 @@ fn test_git_private_commits_already_on_the_remote_do_not_block_push() {
); );
test_env.jj_cmd_ok(&workspace_root, &["bookmark", "create", "bookmark2"]); test_env.jj_cmd_ok(&workspace_root, &["bookmark", "create", "bookmark2"]);
let (_, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push", "-b=bookmark2"]); let (_, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push", "-b=bookmark2"]);
insta::assert_snapshot!(stderr, @r###" insta::assert_snapshot!(stderr, @r#"
Bookmark changes to push to origin: Changes to push to origin:
Add bookmark bookmark2 to ee5b808b0b95 Add bookmark bookmark2 to ee5b808b0b95
"###); "#);
} }
#[test] #[test]
@ -242,10 +242,10 @@ fn test_git_private_commits_are_evaluated_separately_for_each_remote() {
test_env.jj_cmd_ok(&workspace_root, &["new", "-m=public 3"]); test_env.jj_cmd_ok(&workspace_root, &["new", "-m=public 3"]);
test_env.jj_cmd_ok(&workspace_root, &["bookmark", "set", "main"]); test_env.jj_cmd_ok(&workspace_root, &["bookmark", "set", "main"]);
let (_, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push", "-b=main"]); let (_, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push", "-b=main"]);
insta::assert_snapshot!(stderr, @r###" insta::assert_snapshot!(stderr, @r#"
Bookmark changes to push to origin: Changes to push to origin:
Move forward bookmark main from 7eb97bf230ad to d8632ce893ab Move forward bookmark main from 7eb97bf230ad to d8632ce893ab
"###); "#);
test_env.add_config(r#"git.private-commits = "description(glob:'private*')""#); test_env.add_config(r#"git.private-commits = "description(glob:'private*')""#);

View file

@ -90,19 +90,19 @@ fn test_git_push_current_bookmark() {
// First dry-run. `bookmark1` should not get pushed. // First dry-run. `bookmark1` should not get pushed.
let (stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push", "--dry-run"]); let (stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push", "--dry-run"]);
insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stdout, @"");
insta::assert_snapshot!(stderr, @r###" insta::assert_snapshot!(stderr, @r#"
Bookmark changes to push to origin: Changes to push to origin:
Move forward bookmark bookmark2 from 8476341eb395 to bc7610b65a91 Move forward bookmark bookmark2 from 8476341eb395 to bc7610b65a91
Add bookmark my-bookmark to bc7610b65a91 Add bookmark my-bookmark to bc7610b65a91
Dry-run requested, not pushing. Dry-run requested, not pushing.
"###); "#);
let (stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push"]); let (stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push"]);
insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stdout, @"");
insta::assert_snapshot!(stderr, @r###" insta::assert_snapshot!(stderr, @r#"
Bookmark changes to push to origin: Changes to push to origin:
Move forward bookmark bookmark2 from 8476341eb395 to bc7610b65a91 Move forward bookmark bookmark2 from 8476341eb395 to bc7610b65a91
Add bookmark my-bookmark to bc7610b65a91 Add bookmark my-bookmark to bc7610b65a91
"###); "#);
insta::assert_snapshot!(get_bookmark_output(&test_env, &workspace_root), @r###" insta::assert_snapshot!(get_bookmark_output(&test_env, &workspace_root), @r###"
bookmark1: xtvrqkyv 0f8dc656 (empty) modified bookmark1 commit bookmark1: xtvrqkyv 0f8dc656 (empty) modified bookmark1 commit
@origin (ahead by 1 commits, behind by 1 commits): xtvrqkyv hidden d13ecdbd (empty) description 1 @origin (ahead by 1 commits, behind by 1 commits): xtvrqkyv hidden d13ecdbd (empty) description 1
@ -134,10 +134,10 @@ fn test_git_push_current_bookmark() {
// We can move a bookmark backwards // We can move a bookmark backwards
let (stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push", "-bbookmark2"]); let (stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push", "-bbookmark2"]);
insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stdout, @"");
insta::assert_snapshot!(stderr, @r###" insta::assert_snapshot!(stderr, @r#"
Bookmark changes to push to origin: Changes to push to origin:
Move backward bookmark bookmark2 from bc7610b65a91 to 8476341eb395 Move backward bookmark bookmark2 from bc7610b65a91 to 8476341eb395
"###); "#);
} }
#[test] #[test]
@ -153,10 +153,10 @@ fn test_git_push_parent_bookmark() {
std::fs::write(workspace_root.join("file"), "file").unwrap(); std::fs::write(workspace_root.join("file"), "file").unwrap();
let (stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push"]); let (stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push"]);
insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stdout, @"");
insta::assert_snapshot!(stderr, @r###" insta::assert_snapshot!(stderr, @r#"
Bookmark changes to push to origin: Changes to push to origin:
Move sideways bookmark bookmark1 from d13ecdbda2a2 to e612d524a5c6 Move sideways bookmark bookmark1 from d13ecdbda2a2 to e612d524a5c6
"###); "#);
} }
#[test] #[test]
@ -213,10 +213,10 @@ fn test_git_push_other_remote_has_bookmark() {
test_env.jj_cmd_ok(&workspace_root, &["describe", "-m=modified"]); test_env.jj_cmd_ok(&workspace_root, &["describe", "-m=modified"]);
let (stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push"]); let (stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push"]);
insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stdout, @"");
insta::assert_snapshot!(stderr, @r###" insta::assert_snapshot!(stderr, @r#"
Bookmark changes to push to origin: Changes to push to origin:
Move sideways bookmark bookmark1 from d13ecdbda2a2 to a657f1b61b94 Move sideways bookmark bookmark1 from d13ecdbda2a2 to a657f1b61b94
"###); "#);
// Since it's already pushed to origin, nothing will happen if push again // Since it's already pushed to origin, nothing will happen if push again
let (stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push"]); let (stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push"]);
insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stdout, @"");
@ -234,10 +234,10 @@ fn test_git_push_other_remote_has_bookmark() {
// TODO: Saner test? // TODO: Saner test?
let (stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push", "--remote=other"]); let (stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push", "--remote=other"]);
insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stdout, @"");
insta::assert_snapshot!(stderr, @r###" insta::assert_snapshot!(stderr, @r#"
Bookmark changes to push to other: Changes to push to other:
Add bookmark bookmark1 to a657f1b61b94 Add bookmark bookmark1 to a657f1b61b94
"###); "#);
} }
#[test] #[test]
@ -258,12 +258,12 @@ fn test_git_push_forward_unexpectedly_moved() {
// Pushing should fail // Pushing should fail
let stderr = test_env.jj_cmd_failure(&workspace_root, &["git", "push"]); let stderr = test_env.jj_cmd_failure(&workspace_root, &["git", "push"]);
insta::assert_snapshot!(stderr, @r###" insta::assert_snapshot!(stderr, @r#"
Bookmark changes to push to origin: Changes to push to origin:
Move forward bookmark bookmark1 from d13ecdbda2a2 to 6750425ff51c Move forward bookmark bookmark1 from d13ecdbda2a2 to 6750425ff51c
Error: Refusing to push a bookmark that unexpectedly moved on the remote. Affected refs: refs/heads/bookmark1 Error: Refusing to push a bookmark that unexpectedly moved on the remote. Affected refs: refs/heads/bookmark1
Hint: Try fetching from the remote, then make the bookmark point to where you want it to be, and push again. Hint: Try fetching from the remote, then make the bookmark point to where you want it to be, and push again.
"###); "#);
} }
#[test] #[test]
@ -298,12 +298,12 @@ fn test_git_push_sideways_unexpectedly_moved() {
"###); "###);
let stderr = test_env.jj_cmd_failure(&workspace_root, &["git", "push"]); let stderr = test_env.jj_cmd_failure(&workspace_root, &["git", "push"]);
insta::assert_snapshot!(stderr, @r###" insta::assert_snapshot!(stderr, @r#"
Bookmark changes to push to origin: Changes to push to origin:
Move sideways bookmark bookmark1 from d13ecdbda2a2 to 0f8bf988588e Move sideways bookmark bookmark1 from d13ecdbda2a2 to 0f8bf988588e
Error: Refusing to push a bookmark that unexpectedly moved on the remote. Affected refs: refs/heads/bookmark1 Error: Refusing to push a bookmark that unexpectedly moved on the remote. Affected refs: refs/heads/bookmark1
Hint: Try fetching from the remote, then make the bookmark point to where you want it to be, and push again. Hint: Try fetching from the remote, then make the bookmark point to where you want it to be, and push again.
"###); "#);
} }
// This tests whether the push checks that the remote bookmarks are in expected // This tests whether the push checks that the remote bookmarks are in expected
@ -336,12 +336,12 @@ fn test_git_push_deletion_unexpectedly_moved() {
let stderr = let stderr =
test_env.jj_cmd_failure(&workspace_root, &["git", "push", "--bookmark", "bookmark1"]); test_env.jj_cmd_failure(&workspace_root, &["git", "push", "--bookmark", "bookmark1"]);
insta::assert_snapshot!(stderr, @r###" insta::assert_snapshot!(stderr, @r#"
Bookmark changes to push to origin: Changes to push to origin:
Delete bookmark bookmark1 from d13ecdbda2a2 Delete bookmark bookmark1 from d13ecdbda2a2
Error: Refusing to push a bookmark that unexpectedly moved on the remote. Affected refs: refs/heads/bookmark1 Error: Refusing to push a bookmark that unexpectedly moved on the remote. Affected refs: refs/heads/bookmark1
Hint: Try fetching from the remote, then make the bookmark point to where you want it to be, and push again. Hint: Try fetching from the remote, then make the bookmark point to where you want it to be, and push again.
"###); "#);
} }
#[test] #[test]
@ -375,12 +375,12 @@ fn test_git_push_unexpectedly_deleted() {
// Pushing a moved bookmark fails if deleted on remote // Pushing a moved bookmark fails if deleted on remote
let stderr = test_env.jj_cmd_failure(&workspace_root, &["git", "push"]); let stderr = test_env.jj_cmd_failure(&workspace_root, &["git", "push"]);
insta::assert_snapshot!(stderr, @r###" insta::assert_snapshot!(stderr, @r#"
Bookmark changes to push to origin: Changes to push to origin:
Move sideways bookmark bookmark1 from d13ecdbda2a2 to 1ebe27ba04bf Move sideways bookmark bookmark1 from d13ecdbda2a2 to 1ebe27ba04bf
Error: Refusing to push a bookmark that unexpectedly moved on the remote. Affected refs: refs/heads/bookmark1 Error: Refusing to push a bookmark that unexpectedly moved on the remote. Affected refs: refs/heads/bookmark1
Hint: Try fetching from the remote, then make the bookmark point to where you want it to be, and push again. Hint: Try fetching from the remote, then make the bookmark point to where you want it to be, and push again.
"###); "#);
test_env.jj_cmd_ok(&workspace_root, &["bookmark", "delete", "bookmark1"]); test_env.jj_cmd_ok(&workspace_root, &["bookmark", "delete", "bookmark1"]);
insta::assert_snapshot!(get_bookmark_output(&test_env, &workspace_root), @r###" insta::assert_snapshot!(get_bookmark_output(&test_env, &workspace_root), @r###"
@ -393,10 +393,10 @@ fn test_git_push_unexpectedly_deleted() {
// bookmark1@origin to exist and point somewhere. // bookmark1@origin to exist and point somewhere.
let (stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push", "-bbookmark1"]); let (stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push", "-bbookmark1"]);
insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stdout, @"");
insta::assert_snapshot!(stderr, @r###" insta::assert_snapshot!(stderr, @r#"
Bookmark changes to push to origin: Changes to push to origin:
Delete bookmark bookmark1 from d13ecdbda2a2 Delete bookmark bookmark1 from d13ecdbda2a2
"###); "#);
} }
#[test] #[test]
@ -417,12 +417,12 @@ fn test_git_push_creation_unexpectedly_already_exists() {
"###); "###);
let stderr = test_env.jj_cmd_failure(&workspace_root, &["git", "push"]); let stderr = test_env.jj_cmd_failure(&workspace_root, &["git", "push"]);
insta::assert_snapshot!(stderr, @r###" insta::assert_snapshot!(stderr, @r#"
Bookmark changes to push to origin: Changes to push to origin:
Add bookmark bookmark1 to cb17dcdc74d5 Add bookmark bookmark1 to cb17dcdc74d5
Error: Refusing to push a bookmark that unexpectedly moved on the remote. Affected refs: refs/heads/bookmark1 Error: Refusing to push a bookmark that unexpectedly moved on the remote. Affected refs: refs/heads/bookmark1
Hint: Try fetching from the remote, then make the bookmark point to where you want it to be, and push again. Hint: Try fetching from the remote, then make the bookmark point to where you want it to be, and push again.
"###); "#);
} }
#[test] #[test]
@ -435,10 +435,10 @@ fn test_git_push_locally_created_and_rewritten() {
test_env.jj_cmd_ok(&workspace_root, &["new", "root()", "-mlocal 1"]); test_env.jj_cmd_ok(&workspace_root, &["new", "root()", "-mlocal 1"]);
test_env.jj_cmd_ok(&workspace_root, &["bookmark", "create", "my"]); test_env.jj_cmd_ok(&workspace_root, &["bookmark", "create", "my"]);
let (_stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push"]); let (_stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push"]);
insta::assert_snapshot!(stderr, @r###" insta::assert_snapshot!(stderr, @r#"
Bookmark changes to push to origin: Changes to push to origin:
Add bookmark my to fcc999921ce9 Add bookmark my to fcc999921ce9
"###); "#);
// Rewrite it and push again, which would fail if the pushed bookmark weren't // Rewrite it and push again, which would fail if the pushed bookmark weren't
// set to "tracking" // set to "tracking"
@ -452,10 +452,10 @@ fn test_git_push_locally_created_and_rewritten() {
@origin (ahead by 1 commits, behind by 1 commits): vruxwmqv hidden fcc99992 (empty) local 1 @origin (ahead by 1 commits, behind by 1 commits): vruxwmqv hidden fcc99992 (empty) local 1
"###); "###);
let (_stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push"]); let (_stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push"]);
insta::assert_snapshot!(stderr, @r###" insta::assert_snapshot!(stderr, @r#"
Bookmark changes to push to origin: Changes to push to origin:
Move sideways bookmark my from fcc999921ce9 to bde1d2e44b2a Move sideways bookmark my from fcc999921ce9 to bde1d2e44b2a
"###); "#);
} }
#[test] #[test]
@ -480,25 +480,25 @@ fn test_git_push_multiple() {
let (stdout, stderr) = let (stdout, stderr) =
test_env.jj_cmd_ok(&workspace_root, &["git", "push", "--all", "--dry-run"]); test_env.jj_cmd_ok(&workspace_root, &["git", "push", "--all", "--dry-run"]);
insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stdout, @"");
insta::assert_snapshot!(stderr, @r###" insta::assert_snapshot!(stderr, @r#"
Bookmark changes to push to origin: Changes to push to origin:
Delete bookmark bookmark1 from d13ecdbda2a2 Delete bookmark bookmark1 from d13ecdbda2a2
Move sideways bookmark bookmark2 from 8476341eb395 to c4a3c3105d92 Move sideways bookmark bookmark2 from 8476341eb395 to c4a3c3105d92
Add bookmark my-bookmark to c4a3c3105d92 Add bookmark my-bookmark to c4a3c3105d92
Dry-run requested, not pushing. Dry-run requested, not pushing.
"###); "#);
// Dry run requesting two specific bookmarks // Dry run requesting two specific bookmarks
let (stdout, stderr) = test_env.jj_cmd_ok( let (stdout, stderr) = test_env.jj_cmd_ok(
&workspace_root, &workspace_root,
&["git", "push", "-b=bookmark1", "-b=my-bookmark", "--dry-run"], &["git", "push", "-b=bookmark1", "-b=my-bookmark", "--dry-run"],
); );
insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stdout, @"");
insta::assert_snapshot!(stderr, @r###" insta::assert_snapshot!(stderr, @r#"
Bookmark changes to push to origin: Changes to push to origin:
Delete bookmark bookmark1 from d13ecdbda2a2 Delete bookmark bookmark1 from d13ecdbda2a2
Add bookmark my-bookmark to c4a3c3105d92 Add bookmark my-bookmark to c4a3c3105d92
Dry-run requested, not pushing. Dry-run requested, not pushing.
"###); "#);
// Dry run requesting two specific bookmarks twice // Dry run requesting two specific bookmarks twice
let (stdout, stderr) = test_env.jj_cmd_ok( let (stdout, stderr) = test_env.jj_cmd_ok(
&workspace_root, &workspace_root,
@ -513,24 +513,24 @@ fn test_git_push_multiple() {
], ],
); );
insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stdout, @"");
insta::assert_snapshot!(stderr, @r###" insta::assert_snapshot!(stderr, @r#"
Bookmark changes to push to origin: Changes to push to origin:
Delete bookmark bookmark1 from d13ecdbda2a2 Delete bookmark bookmark1 from d13ecdbda2a2
Add bookmark my-bookmark to c4a3c3105d92 Add bookmark my-bookmark to c4a3c3105d92
Dry-run requested, not pushing. Dry-run requested, not pushing.
"###); "#);
// Dry run with glob pattern // Dry run with glob pattern
let (stdout, stderr) = test_env.jj_cmd_ok( let (stdout, stderr) = test_env.jj_cmd_ok(
&workspace_root, &workspace_root,
&["git", "push", "-b=glob:bookmark?", "--dry-run"], &["git", "push", "-b=glob:bookmark?", "--dry-run"],
); );
insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stdout, @"");
insta::assert_snapshot!(stderr, @r###" insta::assert_snapshot!(stderr, @r#"
Bookmark changes to push to origin: Changes to push to origin:
Delete bookmark bookmark1 from d13ecdbda2a2 Delete bookmark bookmark1 from d13ecdbda2a2
Move sideways bookmark bookmark2 from 8476341eb395 to c4a3c3105d92 Move sideways bookmark bookmark2 from 8476341eb395 to c4a3c3105d92
Dry-run requested, not pushing. Dry-run requested, not pushing.
"###); "#);
// Unmatched bookmark name is error // Unmatched bookmark name is error
let stderr = test_env.jj_cmd_failure(&workspace_root, &["git", "push", "-b=foo"]); let stderr = test_env.jj_cmd_failure(&workspace_root, &["git", "push", "-b=foo"]);
@ -547,12 +547,12 @@ fn test_git_push_multiple() {
let (stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push", "--all"]); let (stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push", "--all"]);
insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stdout, @"");
insta::assert_snapshot!(stderr, @r###" insta::assert_snapshot!(stderr, @r#"
Bookmark changes to push to origin: Changes to push to origin:
Delete bookmark bookmark1 from d13ecdbda2a2 Delete bookmark bookmark1 from d13ecdbda2a2
Move sideways bookmark bookmark2 from 8476341eb395 to c4a3c3105d92 Move sideways bookmark bookmark2 from 8476341eb395 to c4a3c3105d92
Add bookmark my-bookmark to c4a3c3105d92 Add bookmark my-bookmark to c4a3c3105d92
"###); "#);
insta::assert_snapshot!(get_bookmark_output(&test_env, &workspace_root), @r###" insta::assert_snapshot!(get_bookmark_output(&test_env, &workspace_root), @r###"
bookmark2: yqosqzyt c4a3c310 (empty) foo bookmark2: yqosqzyt c4a3c310 (empty) foo
@origin: yqosqzyt c4a3c310 (empty) foo @origin: yqosqzyt c4a3c310 (empty) foo
@ -581,11 +581,11 @@ fn test_git_push_changes() {
let (stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push", "--change", "@"]); let (stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push", "--change", "@"]);
insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stdout, @"");
insta::assert_snapshot!(stderr, @r###" insta::assert_snapshot!(stderr, @r#"
Creating bookmark push-yostqsxwqrlt for revision yostqsxwqrlt Creating bookmark push-yostqsxwqrlt for revision yostqsxwqrlt
Bookmark changes to push to origin: Changes to push to origin:
Add bookmark push-yostqsxwqrlt to cf1a53a8800a Add bookmark push-yostqsxwqrlt to cf1a53a8800a
"###); "#);
// test pushing two changes at once // test pushing two changes at once
std::fs::write(workspace_root.join("file"), "modified2").unwrap(); std::fs::write(workspace_root.join("file"), "modified2").unwrap();
let stderr = test_env.jj_cmd_failure(&workspace_root, &["git", "push", "-c=(@|@-)"]); let stderr = test_env.jj_cmd_failure(&workspace_root, &["git", "push", "-c=(@|@-)"]);
@ -599,20 +599,20 @@ fn test_git_push_changes() {
// test pushing two changes at once, part 2 // test pushing two changes at once, part 2
let (stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push", "-c=all:(@|@-)"]); let (stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push", "-c=all:(@|@-)"]);
insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stdout, @"");
insta::assert_snapshot!(stderr, @r###" insta::assert_snapshot!(stderr, @r#"
Creating bookmark push-yqosqzytrlsw for revision yqosqzytrlsw Creating bookmark push-yqosqzytrlsw for revision yqosqzytrlsw
Bookmark changes to push to origin: Changes to push to origin:
Move sideways bookmark push-yostqsxwqrlt from cf1a53a8800a to 16c169664e9f Move sideways bookmark push-yostqsxwqrlt from cf1a53a8800a to 16c169664e9f
Add bookmark push-yqosqzytrlsw to a050abf4ff07 Add bookmark push-yqosqzytrlsw to a050abf4ff07
"###); "#);
// specifying the same change twice doesn't break things // specifying the same change twice doesn't break things
std::fs::write(workspace_root.join("file"), "modified3").unwrap(); std::fs::write(workspace_root.join("file"), "modified3").unwrap();
let (stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push", "-c=all:(@|@)"]); let (stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push", "-c=all:(@|@)"]);
insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stdout, @"");
insta::assert_snapshot!(stderr, @r###" insta::assert_snapshot!(stderr, @r#"
Bookmark changes to push to origin: Changes to push to origin:
Move sideways bookmark push-yostqsxwqrlt from 16c169664e9f to ef6313d50ac1 Move sideways bookmark push-yostqsxwqrlt from 16c169664e9f to ef6313d50ac1
"###); "#);
// specifying the same bookmark with --change/--bookmark doesn't break things // specifying the same bookmark with --change/--bookmark doesn't break things
std::fs::write(workspace_root.join("file"), "modified4").unwrap(); std::fs::write(workspace_root.join("file"), "modified4").unwrap();
@ -621,10 +621,10 @@ fn test_git_push_changes() {
&["git", "push", "-c=@", "-b=push-yostqsxwqrlt"], &["git", "push", "-c=@", "-b=push-yostqsxwqrlt"],
); );
insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stdout, @"");
insta::assert_snapshot!(stderr, @r###" insta::assert_snapshot!(stderr, @r#"
Bookmark changes to push to origin: Changes to push to origin:
Move sideways bookmark push-yostqsxwqrlt from ef6313d50ac1 to c1e65d3a64ce Move sideways bookmark push-yostqsxwqrlt from ef6313d50ac1 to c1e65d3a64ce
"###); "#);
// try again with --change that moves the bookmark forward // try again with --change that moves the bookmark forward
std::fs::write(workspace_root.join("file"), "modified5").unwrap(); std::fs::write(workspace_root.join("file"), "modified5").unwrap();
@ -650,10 +650,10 @@ fn test_git_push_changes() {
&["git", "push", "-c=@", "-b=push-yostqsxwqrlt"], &["git", "push", "-c=@", "-b=push-yostqsxwqrlt"],
); );
insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stdout, @"");
insta::assert_snapshot!(stderr, @r###" insta::assert_snapshot!(stderr, @r#"
Bookmark changes to push to origin: Changes to push to origin:
Move sideways bookmark push-yostqsxwqrlt from c1e65d3a64ce to 38cb417ce3a6 Move sideways bookmark push-yostqsxwqrlt from c1e65d3a64ce to 38cb417ce3a6
"###); "#);
let stdout = test_env.jj_cmd_success(&workspace_root, &["status"]); let stdout = test_env.jj_cmd_success(&workspace_root, &["status"]);
insta::assert_snapshot!(stdout, @r###" insta::assert_snapshot!(stdout, @r###"
Working copy changes: Working copy changes:
@ -674,11 +674,11 @@ fn test_git_push_changes() {
], ],
); );
insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stdout, @"");
insta::assert_snapshot!(stderr, @r###" insta::assert_snapshot!(stderr, @r#"
Creating bookmark test-yostqsxwqrlt for revision yostqsxwqrlt Creating bookmark test-yostqsxwqrlt for revision yostqsxwqrlt
Bookmark changes to push to origin: Changes to push to origin:
Add bookmark test-yostqsxwqrlt to 38cb417ce3a6 Add bookmark test-yostqsxwqrlt to 38cb417ce3a6
"###); "#);
// Test deprecation warning for `git.push-branch-prefix` // Test deprecation warning for `git.push-branch-prefix`
let (stdout, stderr) = test_env.jj_cmd_ok( let (stdout, stderr) = test_env.jj_cmd_ok(
@ -692,12 +692,12 @@ fn test_git_push_changes() {
], ],
); );
insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stdout, @"");
insta::assert_snapshot!(stderr, @r###" insta::assert_snapshot!(stderr, @r#"
Warning: Config git.push-branch-prefix is deprecated. Please switch to git.push-bookmark-prefix Warning: Config git.push-branch-prefix is deprecated. Please switch to git.push-bookmark-prefix
Creating bookmark branch-yostqsxwqrlt for revision yostqsxwqrlt Creating bookmark branch-yostqsxwqrlt for revision yostqsxwqrlt
Bookmark changes to push to origin: Changes to push to origin:
Add bookmark branch-yostqsxwqrlt to 38cb417ce3a6 Add bookmark branch-yostqsxwqrlt to 38cb417ce3a6
"###); "#);
} }
#[test] #[test]
@ -730,44 +730,44 @@ fn test_git_push_revisions() {
let (stdout, stderr) = let (stdout, stderr) =
test_env.jj_cmd_ok(&workspace_root, &["git", "push", "-r=@-", "--dry-run"]); test_env.jj_cmd_ok(&workspace_root, &["git", "push", "-r=@-", "--dry-run"]);
insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stdout, @"");
insta::assert_snapshot!(stderr, @r###" insta::assert_snapshot!(stderr, @r#"
Bookmark changes to push to origin: Changes to push to origin:
Add bookmark bookmark-1 to 5f432a855e59 Add bookmark bookmark-1 to 5f432a855e59
Dry-run requested, not pushing. Dry-run requested, not pushing.
"###); "#);
// Push multiple revisions of which some have bookmarks // Push multiple revisions of which some have bookmarks
let (stdout, stderr) = test_env.jj_cmd_ok( let (stdout, stderr) = test_env.jj_cmd_ok(
&workspace_root, &workspace_root,
&["git", "push", "-r=@--", "-r=@-", "--dry-run"], &["git", "push", "-r=@--", "-r=@-", "--dry-run"],
); );
insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stdout, @"");
insta::assert_snapshot!(stderr, @r###" insta::assert_snapshot!(stderr, @r#"
Warning: No bookmarks point to the specified revisions: @-- Warning: No bookmarks point to the specified revisions: @--
Bookmark changes to push to origin: Changes to push to origin:
Add bookmark bookmark-1 to 5f432a855e59 Add bookmark bookmark-1 to 5f432a855e59
Dry-run requested, not pushing. Dry-run requested, not pushing.
"###); "#);
// Push a revision with a multiple bookmarks // Push a revision with a multiple bookmarks
let (stdout, stderr) = let (stdout, stderr) =
test_env.jj_cmd_ok(&workspace_root, &["git", "push", "-r=@", "--dry-run"]); test_env.jj_cmd_ok(&workspace_root, &["git", "push", "-r=@", "--dry-run"]);
insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stdout, @"");
insta::assert_snapshot!(stderr, @r###" insta::assert_snapshot!(stderr, @r#"
Bookmark changes to push to origin: Changes to push to origin:
Add bookmark bookmark-2a to 84f499037f5c Add bookmark bookmark-2a to 84f499037f5c
Add bookmark bookmark-2b to 84f499037f5c Add bookmark bookmark-2b to 84f499037f5c
Dry-run requested, not pushing. Dry-run requested, not pushing.
"###); "#);
// Repeating a commit doesn't result in repeated messages about the bookmark // Repeating a commit doesn't result in repeated messages about the bookmark
let (stdout, stderr) = test_env.jj_cmd_ok( let (stdout, stderr) = test_env.jj_cmd_ok(
&workspace_root, &workspace_root,
&["git", "push", "-r=@-", "-r=@-", "--dry-run"], &["git", "push", "-r=@-", "-r=@-", "--dry-run"],
); );
insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stdout, @"");
insta::assert_snapshot!(stderr, @r###" insta::assert_snapshot!(stderr, @r#"
Bookmark changes to push to origin: Changes to push to origin:
Add bookmark bookmark-1 to 5f432a855e59 Add bookmark bookmark-1 to 5f432a855e59
Dry-run requested, not pushing. Dry-run requested, not pushing.
"###); "#);
} }
#[test] #[test]
@ -794,14 +794,14 @@ fn test_git_push_mixed() {
], ],
); );
insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stdout, @"");
insta::assert_snapshot!(stderr, @r###" insta::assert_snapshot!(stderr, @r#"
Creating bookmark push-yqosqzytrlsw for revision yqosqzytrlsw Creating bookmark push-yqosqzytrlsw for revision yqosqzytrlsw
Bookmark changes to push to origin: Changes to push to origin:
Add bookmark push-yqosqzytrlsw to a050abf4ff07 Add bookmark push-yqosqzytrlsw to a050abf4ff07
Add bookmark bookmark-1 to 5f432a855e59 Add bookmark bookmark-1 to 5f432a855e59
Add bookmark bookmark-2a to 84f499037f5c Add bookmark bookmark-2a to 84f499037f5c
Add bookmark bookmark-2b to 84f499037f5c Add bookmark bookmark-2b to 84f499037f5c
"###); "#);
} }
#[test] #[test]
@ -820,10 +820,10 @@ fn test_git_push_existing_long_bookmark() {
let (stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push", "--change=@"]); let (stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push", "--change=@"]);
insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stdout, @"");
insta::assert_snapshot!(stderr, @r###" insta::assert_snapshot!(stderr, @r#"
Bookmark changes to push to origin: Changes to push to origin:
Add bookmark push-19b790168e73f7a73a98deae21e807c0 to a050abf4ff07 Add bookmark push-19b790168e73f7a73a98deae21e807c0 to a050abf4ff07
"###); "#);
} }
#[test] #[test]
@ -900,11 +900,11 @@ fn test_git_push_no_description_in_immutable() {
&["git", "push", "--bookmark=my-bookmark", "--dry-run"], &["git", "push", "--bookmark=my-bookmark", "--dry-run"],
); );
insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stdout, @"");
insta::assert_snapshot!(stderr, @r###" insta::assert_snapshot!(stderr, @r#"
Bookmark changes to push to origin: Changes to push to origin:
Add bookmark my-bookmark to ea7373507ad9 Add bookmark my-bookmark to ea7373507ad9
Dry-run requested, not pushing. Dry-run requested, not pushing.
"###); "#);
} }
#[test] #[test]
@ -968,11 +968,11 @@ fn test_git_push_missing_author_in_immutable() {
&["git", "push", "--bookmark=my-bookmark", "--dry-run"], &["git", "push", "--bookmark=my-bookmark", "--dry-run"],
); );
insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stdout, @"");
insta::assert_snapshot!(stderr, @r###" insta::assert_snapshot!(stderr, @r#"
Bookmark changes to push to origin: Changes to push to origin:
Add bookmark my-bookmark to 68fdae89de4f Add bookmark my-bookmark to 68fdae89de4f
Dry-run requested, not pushing. Dry-run requested, not pushing.
"###); "#);
} }
#[test] #[test]
@ -1047,11 +1047,11 @@ fn test_git_push_missing_committer_in_immutable() {
&["git", "push", "--bookmark=my-bookmark", "--dry-run"], &["git", "push", "--bookmark=my-bookmark", "--dry-run"],
); );
insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stdout, @"");
insta::assert_snapshot!(stderr, @r###" insta::assert_snapshot!(stderr, @r#"
Bookmark changes to push to origin: Changes to push to origin:
Add bookmark my-bookmark to c79f85e90b4a Add bookmark my-bookmark to c79f85e90b4a
Dry-run requested, not pushing. Dry-run requested, not pushing.
"###); "#);
} }
#[test] #[test]
@ -1061,10 +1061,10 @@ fn test_git_push_deleted() {
test_env.jj_cmd_ok(&workspace_root, &["bookmark", "delete", "bookmark1"]); test_env.jj_cmd_ok(&workspace_root, &["bookmark", "delete", "bookmark1"]);
let (stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push", "--deleted"]); let (stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push", "--deleted"]);
insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stdout, @"");
insta::assert_snapshot!(stderr, @r###" insta::assert_snapshot!(stderr, @r#"
Bookmark changes to push to origin: Changes to push to origin:
Delete bookmark bookmark1 from d13ecdbda2a2 Delete bookmark bookmark1 from d13ecdbda2a2
"###); "#);
let stdout = test_env.jj_cmd_success(&workspace_root, &["log", "-rall()"]); let stdout = test_env.jj_cmd_success(&workspace_root, &["log", "-rall()"]);
insta::assert_snapshot!(stdout, @r###" insta::assert_snapshot!(stdout, @r###"
rlzusymt test.user@example.com 2001-02-03 08:05:10 bookmark2 8476341e rlzusymt test.user@example.com 2001-02-03 08:05:10 bookmark2 8476341e
@ -1137,23 +1137,23 @@ fn test_git_push_conflicting_bookmarks() {
bump_bookmark1(); bump_bookmark1();
let (stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push", "--all"]); let (stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push", "--all"]);
insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stdout, @"");
insta::assert_snapshot!(stderr, @r###" insta::assert_snapshot!(stderr, @r#"
Warning: Bookmark bookmark2 is conflicted Warning: Bookmark bookmark2 is conflicted
Hint: Run `jj bookmark list` to inspect, and use `jj bookmark set` to fix it up. Hint: Run `jj bookmark list` to inspect, and use `jj bookmark set` to fix it up.
Bookmark changes to push to origin: Changes to push to origin:
Move forward bookmark bookmark1 from d13ecdbda2a2 to 8df52121b022 Move forward bookmark bookmark1 from d13ecdbda2a2 to 8df52121b022
"###); "#);
// --revisions shouldn't be blocked by conflicting bookmark // --revisions shouldn't be blocked by conflicting bookmark
bump_bookmark1(); bump_bookmark1();
let (stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push", "-rall()"]); let (stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push", "-rall()"]);
insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stdout, @"");
insta::assert_snapshot!(stderr, @r###" insta::assert_snapshot!(stderr, @r#"
Warning: Bookmark bookmark2 is conflicted Warning: Bookmark bookmark2 is conflicted
Hint: Run `jj bookmark list` to inspect, and use `jj bookmark set` to fix it up. Hint: Run `jj bookmark list` to inspect, and use `jj bookmark set` to fix it up.
Bookmark changes to push to origin: Changes to push to origin:
Move forward bookmark bookmark1 from 8df52121b022 to 345e1f64a64d Move forward bookmark bookmark1 from 8df52121b022 to 345e1f64a64d
"###); "#);
} }
#[test] #[test]
@ -1201,11 +1201,11 @@ fn test_git_push_tracked_vs_all() {
// try to push it and no other bookmarks. // try to push it and no other bookmarks.
let (_stdout, stderr) = let (_stdout, stderr) =
test_env.jj_cmd_ok(&workspace_root, &["git", "push", "--tracked", "--dry-run"]); test_env.jj_cmd_ok(&workspace_root, &["git", "push", "--tracked", "--dry-run"]);
insta::assert_snapshot!(stderr, @r###" insta::assert_snapshot!(stderr, @r#"
Bookmark changes to push to origin: Changes to push to origin:
Delete bookmark bookmark2 from 8476341eb395 Delete bookmark bookmark2 from 8476341eb395
Dry-run requested, not pushing. Dry-run requested, not pushing.
"###); "#);
// Untrack the last remaining tracked bookmark. // Untrack the last remaining tracked bookmark.
test_env.jj_cmd_ok( test_env.jj_cmd_ok(
@ -1242,12 +1242,12 @@ fn test_git_push_tracked_vs_all() {
// - We could consider showing some hint on `jj bookmark untrack // - We could consider showing some hint on `jj bookmark untrack
// bookmark2@origin` instead of showing an error here. // bookmark2@origin` instead of showing an error here.
let (_stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push", "--all"]); let (_stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push", "--all"]);
insta::assert_snapshot!(stderr, @r###" insta::assert_snapshot!(stderr, @r#"
Warning: Non-tracking remote bookmark bookmark1@origin exists Warning: Non-tracking remote bookmark bookmark1@origin exists
Hint: Run `jj bookmark track bookmark1@origin` to import the remote bookmark. Hint: Run `jj bookmark track bookmark1@origin` to import the remote bookmark.
Bookmark changes to push to origin: Changes to push to origin:
Add bookmark bookmark3 to 1aa4f1f2ef7f Add bookmark bookmark3 to 1aa4f1f2ef7f
"###); "#);
} }
#[test] #[test]
@ -1303,12 +1303,12 @@ fn test_git_push_to_remote_named_git() {
let stderr = let stderr =
test_env.jj_cmd_failure(&workspace_root, &["git", "push", "--all", "--remote=git"]); test_env.jj_cmd_failure(&workspace_root, &["git", "push", "--all", "--remote=git"]);
insta::assert_snapshot!(stderr, @r###" insta::assert_snapshot!(stderr, @r#"
Bookmark changes to push to git: Changes to push to git:
Add bookmark bookmark1 to d13ecdbda2a2 Add bookmark bookmark1 to d13ecdbda2a2
Add bookmark bookmark2 to 8476341eb395 Add bookmark bookmark2 to 8476341eb395
Error: Git remote named 'git' is reserved for local Git repository Error: Git remote named 'git' is reserved for local Git repository
"###); "#);
} }
fn get_bookmark_output(test_env: &TestEnvironment, repo_path: &Path) -> String { fn get_bookmark_output(test_env: &TestEnvironment, repo_path: &Path) -> String {

View file

@ -1235,14 +1235,14 @@ fn test_op_diff() {
let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["git", "push", "--tracked"]); let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["git", "push", "--tracked"]);
insta::assert_snapshot!(&stdout, @r###" insta::assert_snapshot!(&stdout, @r###"
"###); "###);
insta::assert_snapshot!(&stderr, @r###" insta::assert_snapshot!(&stderr, @r#"
Bookmark changes to push to origin: Changes to push to origin:
Move forward bookmark bookmark-1 from 4f856199edbf to 358b82d6be53 Move forward bookmark bookmark-1 from 4f856199edbf to 358b82d6be53
Delete bookmark bookmark-2 from d487febd08e6 Delete bookmark bookmark-2 from d487febd08e6
Warning: The working-copy commit in workspace 'default' became immutable, so a new commit has been created on top of it. Warning: The working-copy commit in workspace 'default' became immutable, so a new commit has been created on top of it.
Working copy now at: oupztwtk 2f0718a0 (empty) (no description set) Working copy now at: oupztwtk 2f0718a0 (empty) (no description set)
Parent commit : wvuyspvk 358b82d6 bookmark-1 | (empty) new commit Parent commit : wvuyspvk 358b82d6 bookmark-1 | (empty) new commit
"###); "#);
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "diff"]); let stdout = test_env.jj_cmd_success(&repo_path, &["op", "diff"]);
insta::assert_snapshot!(&stdout, @r###" insta::assert_snapshot!(&stdout, @r###"
From operation 0f77d601f1cd: delete bookmark bookmark-2 From operation 0f77d601f1cd: delete bookmark bookmark-2
@ -1931,14 +1931,14 @@ fn test_op_show() {
let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["git", "push", "--tracked"]); let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["git", "push", "--tracked"]);
insta::assert_snapshot!(&stdout, @r###" insta::assert_snapshot!(&stdout, @r###"
"###); "###);
insta::assert_snapshot!(&stderr, @r###" insta::assert_snapshot!(&stderr, @r#"
Bookmark changes to push to origin: Changes to push to origin:
Move forward bookmark bookmark-1 from 4f856199edbf to eb6c2b21ec20 Move forward bookmark bookmark-1 from 4f856199edbf to eb6c2b21ec20
Delete bookmark bookmark-2 from d487febd08e6 Delete bookmark bookmark-2 from d487febd08e6
Warning: The working-copy commit in workspace 'default' became immutable, so a new commit has been created on top of it. Warning: The working-copy commit in workspace 'default' became immutable, so a new commit has been created on top of it.
Working copy now at: pzsxstzt 7ab2d837 (empty) (no description set) Working copy now at: pzsxstzt 7ab2d837 (empty) (no description set)
Parent commit : xznxytkn eb6c2b21 bookmark-1 | (empty) new commit Parent commit : xznxytkn eb6c2b21 bookmark-1 | (empty) new commit
"###); "#);
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "show"]); let stdout = test_env.jj_cmd_success(&repo_path, &["op", "show"]);
insta::assert_snapshot!(&stdout, @r###" insta::assert_snapshot!(&stdout, @r###"
5d994bb7d230 test-username@host.example.com 2001-02-03 04:05:30.000 +07:00 - 2001-02-03 04:05:30.000 +07:00 5d994bb7d230 test-username@host.example.com 2001-02-03 04:05:30.000 +07:00 - 2001-02-03 04:05:30.000 +07:00