mirror of
https://github.com/martinvonz/jj.git
synced 2025-01-15 16:53:25 +00:00
cli git push
: change warning if default revset contains no branches
Previously, `jj git push; jj git push` would tell the user that "No branches point to the specified revisions.". I found this confusing, even though strictly speaking it is correct (as the default revset only considers revisions that haven't been pushed to the remote). Closes #2241
This commit is contained in:
parent
64fa84746a
commit
d7bbbd1c29
2 changed files with 17 additions and 8 deletions
|
@ -780,11 +780,20 @@ fn cmd_git_push(
|
||||||
Err(reason) => reason.print(ui)?,
|
Err(reason) => reason.print(ui)?,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!args.revisions.is_empty() || use_default_revset) && branches_targeted.is_empty() {
|
if branches_targeted.is_empty() {
|
||||||
writeln!(
|
if use_default_revset {
|
||||||
ui.warning(),
|
writeln!(
|
||||||
"No branches point to the specified revisions."
|
ui.warning(),
|
||||||
)?;
|
"No branches found in the default push revset, \
|
||||||
|
`remote_branches(remote={remote})..@`."
|
||||||
|
)?;
|
||||||
|
} else if !args.revisions.is_empty() {
|
||||||
|
writeln!(
|
||||||
|
ui.warning(),
|
||||||
|
"No branches point to the specified revisions."
|
||||||
|
)?;
|
||||||
|
} else { /* A plain "Nothing changed" message will suffice */
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tx_description = format!(
|
tx_description = format!(
|
||||||
|
|
|
@ -135,7 +135,7 @@ fn test_git_push_no_matching_branch() {
|
||||||
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###"
|
||||||
No branches point to the specified revisions.
|
No branches found in the default push revset, `remote_branches(remote=origin)..@`.
|
||||||
Nothing changed.
|
Nothing changed.
|
||||||
"###);
|
"###);
|
||||||
}
|
}
|
||||||
|
@ -147,7 +147,7 @@ fn test_git_push_matching_branch_unchanged() {
|
||||||
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###"
|
||||||
No branches point to the specified revisions.
|
No branches found in the default push revset, `remote_branches(remote=origin)..@`.
|
||||||
Nothing changed.
|
Nothing changed.
|
||||||
"###);
|
"###);
|
||||||
}
|
}
|
||||||
|
@ -190,7 +190,7 @@ fn test_git_push_other_remote_has_branch() {
|
||||||
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###"
|
||||||
No branches point to the specified revisions.
|
No branches found in the default push revset, `remote_branches(remote=origin)..@`.
|
||||||
Nothing changed.
|
Nothing changed.
|
||||||
"###);
|
"###);
|
||||||
// But it will still get pushed to another remote
|
// But it will still get pushed to another remote
|
||||||
|
|
Loading…
Reference in a new issue