mirror of
https://github.com/martinvonz/jj.git
synced 2024-12-27 06:27:43 +00:00
cli: print out short change ids with jj git push --change
The follow up diff will make `-c` accept large revsets, so it won't make any sense to print out the original expression when multiple branches will be created from it. Signed-off-by: Austin Seipp <aseipp@pobox.com>
This commit is contained in:
parent
5988a00ae4
commit
aab82cd641
2 changed files with 6 additions and 6 deletions
|
@ -467,12 +467,12 @@ fn update_change_branches(
|
|||
for change_arg in changes {
|
||||
let workspace_command = tx.base_workspace_helper();
|
||||
let commit = workspace_command.resolve_single_rev(change_arg)?;
|
||||
let short_change_id = short_change_hash(commit.change_id());
|
||||
let mut branch_name = format!("{branch_prefix}{}", commit.change_id().hex());
|
||||
let view = tx.base_repo().view();
|
||||
if view.get_local_branch(&branch_name).is_absent() {
|
||||
// A local branch with the full change ID doesn't exist already, so use the
|
||||
// short ID if it's not ambiguous (which it shouldn't be most of the time).
|
||||
let short_change_id = short_change_hash(commit.change_id());
|
||||
if workspace_command
|
||||
.resolve_single_rev(&RevisionArg::from(short_change_id.clone()))
|
||||
.is_ok()
|
||||
|
@ -484,7 +484,7 @@ fn update_change_branches(
|
|||
if view.get_local_branch(&branch_name).is_absent() {
|
||||
writeln!(
|
||||
ui.status(),
|
||||
"Creating branch {branch_name} for revision {change_arg}",
|
||||
"Creating branch {branch_name} for revision {short_change_id}",
|
||||
)?;
|
||||
}
|
||||
tx.mut_repo()
|
||||
|
|
|
@ -580,7 +580,7 @@ fn test_git_push_changes() {
|
|||
let (stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push", "--change", "@"]);
|
||||
insta::assert_snapshot!(stdout, @"");
|
||||
insta::assert_snapshot!(stderr, @r###"
|
||||
Creating branch push-yostqsxwqrlt for revision @
|
||||
Creating branch push-yostqsxwqrlt for revision yostqsxwqrlt
|
||||
Branch changes to push to origin:
|
||||
Add branch push-yostqsxwqrlt to 28d7620ea63a
|
||||
"###);
|
||||
|
@ -589,7 +589,7 @@ fn test_git_push_changes() {
|
|||
let (stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push", "-c=@", "-c=@-"]);
|
||||
insta::assert_snapshot!(stdout, @"");
|
||||
insta::assert_snapshot!(stderr, @r###"
|
||||
Creating branch push-yqosqzytrlsw for revision @-
|
||||
Creating branch push-yqosqzytrlsw for revision yqosqzytrlsw
|
||||
Branch changes to push to origin:
|
||||
Move sideways branch push-yostqsxwqrlt from 28d7620ea63a to 48d8c7948133
|
||||
Add branch push-yqosqzytrlsw to fa16a14170fb
|
||||
|
@ -664,7 +664,7 @@ fn test_git_push_changes() {
|
|||
);
|
||||
insta::assert_snapshot!(stdout, @"");
|
||||
insta::assert_snapshot!(stderr, @r###"
|
||||
Creating branch test-yostqsxwqrlt for revision @
|
||||
Creating branch test-yostqsxwqrlt for revision yostqsxwqrlt
|
||||
Branch changes to push to origin:
|
||||
Add branch test-yostqsxwqrlt to 3e2ce808759b
|
||||
"###);
|
||||
|
@ -759,7 +759,7 @@ fn test_git_push_mixed() {
|
|||
);
|
||||
insta::assert_snapshot!(stdout, @"");
|
||||
insta::assert_snapshot!(stderr, @r###"
|
||||
Creating branch push-yqosqzytrlsw for revision @--
|
||||
Creating branch push-yqosqzytrlsw for revision yqosqzytrlsw
|
||||
Branch changes to push to origin:
|
||||
Add branch push-yqosqzytrlsw to fa16a14170fb
|
||||
Add branch branch-1 to 7decc7932d9c
|
||||
|
|
Loading…
Reference in a new issue