forked from mirrors/jj
cli: make jj abandon
print commit info as it was before the command
As we discussed in #1928, it seems better to print information about abandoned commits in the context of the pre-abandon state. For example, that means that we'll include any branches that pointed to the now-abandoned commits.
This commit is contained in:
parent
a868b2d9a5
commit
7c8f66ab0c
2 changed files with 14 additions and 12 deletions
|
@ -2251,13 +2251,15 @@ fn cmd_abandon(
|
|||
|
||||
if to_abandon.len() == 1 {
|
||||
ui.write("Abandoned commit ")?;
|
||||
tx.write_commit_summary(ui.stdout_formatter().as_mut(), &to_abandon[0])?;
|
||||
tx.base_workspace_helper()
|
||||
.write_commit_summary(ui.stdout_formatter().as_mut(), &to_abandon[0])?;
|
||||
ui.write("\n")?;
|
||||
} else if !args.summary {
|
||||
ui.write("Abandoned the following commits:\n")?;
|
||||
for commit in to_abandon {
|
||||
ui.write(" ")?;
|
||||
tx.write_commit_summary(ui.stdout_formatter().as_mut(), &commit)?;
|
||||
tx.base_workspace_helper()
|
||||
.write_commit_summary(ui.stdout_formatter().as_mut(), &commit)?;
|
||||
ui.write("\n")?;
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -56,7 +56,7 @@ fn test_rebase_branch_with_merge() {
|
|||
|
||||
let stdout = test_env.jj_cmd_success(&repo_path, &["abandon", "d"]);
|
||||
insta::assert_snapshot!(stdout, @r###"
|
||||
Abandoned commit vruxwmqv b7c62f28 d
|
||||
Abandoned commit vruxwmqv b7c62f28 d | d
|
||||
Rebased 1 descendant commits onto parents of abandoned commits
|
||||
Working copy now at: znkkpsqq 11a2e10e e | e
|
||||
Parent commit : rlvkpnrz 2443ea76 a | a
|
||||
|
@ -77,7 +77,7 @@ fn test_rebase_branch_with_merge() {
|
|||
test_env.jj_cmd_success(&repo_path, &["undo"]);
|
||||
let stdout = test_env.jj_cmd_success(&repo_path, &["abandon"] /* abandons `e` */);
|
||||
insta::assert_snapshot!(stdout, @r###"
|
||||
Abandoned commit znkkpsqq 5557ece3 e
|
||||
Abandoned commit znkkpsqq 5557ece3 e | e
|
||||
Working copy now at: nkmrtpmo 6b527513 (empty) (no description set)
|
||||
Parent commit : rlvkpnrz 2443ea76 a e?? | a
|
||||
Added 0 files, modified 0 files, removed 3 files
|
||||
|
@ -102,9 +102,9 @@ fn test_rebase_branch_with_merge() {
|
|||
// of the same problem.
|
||||
insta::assert_snapshot!(stdout, @r###"
|
||||
Abandoned the following commits:
|
||||
znkkpsqq 5557ece3 e
|
||||
vruxwmqv b7c62f28 d
|
||||
royxmykx fe2e8e8b c
|
||||
znkkpsqq 5557ece3 e | e
|
||||
vruxwmqv b7c62f28 d | d
|
||||
royxmykx fe2e8e8b c | c
|
||||
Working copy now at: xtnwkqum e7bb0612 (empty) (no description set)
|
||||
Parent commit : rlvkpnrz 2443ea76 a e?? | a
|
||||
Added 0 files, modified 0 files, removed 3 files
|
||||
|
@ -121,7 +121,7 @@ fn test_rebase_branch_with_merge() {
|
|||
test_env.jj_cmd_success(&repo_path, &["undo"]);
|
||||
let stdout = test_env.jj_cmd_success(&repo_path, &["abandon", "b", "b"]);
|
||||
insta::assert_snapshot!(stdout, @r###"
|
||||
Abandoned commit zsuskuln 1394f625 b
|
||||
Abandoned commit zsuskuln 1394f625 b | b
|
||||
"###);
|
||||
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###"
|
||||
@ e
|
||||
|
@ -138,10 +138,10 @@ fn test_rebase_branch_with_merge() {
|
|||
let stdout = test_env.jj_cmd_success(&repo_path, &["abandon", "d::", "a::"]);
|
||||
insta::assert_snapshot!(stdout, @r###"
|
||||
Abandoned the following commits:
|
||||
znkkpsqq 5557ece3 e
|
||||
vruxwmqv b7c62f28 d
|
||||
zsuskuln 1394f625 b
|
||||
rlvkpnrz 2443ea76 a
|
||||
znkkpsqq 5557ece3 e | e
|
||||
vruxwmqv b7c62f28 d | d
|
||||
zsuskuln 1394f625 b | b
|
||||
rlvkpnrz 2443ea76 a | a
|
||||
Working copy now at: xlzxqlsl af874bff (empty) (no description set)
|
||||
Parent commit : zzzzzzzz 00000000 a b e?? | (empty) (no description set)
|
||||
Added 0 files, modified 0 files, removed 4 files
|
||||
|
|
Loading…
Reference in a new issue