restore, diffedit: do not output "Created ..." message, which dates back to before we couldn't lookup by change id.

This commit is contained in:
Steve Fink 2025-05-01 12:06:32 -07:00 committed by Austin Seipp
parent 1b300fefa2
commit 0eceed9832
5 changed files with 3 additions and 36 deletions

View File

@ -136,8 +136,7 @@ don't make any changes, then the operation will be aborted.",
if tree_id == *target_commit.tree_id() { if tree_id == *target_commit.tree_id() {
writeln!(ui.status(), "Nothing changed.")?; writeln!(ui.status(), "Nothing changed.")?;
} else { } else {
let new_commit = tx tx.repo_mut()
.repo_mut()
.rewrite_commit(&target_commit) .rewrite_commit(&target_commit)
.set_tree_id(tree_id) .set_tree_id(tree_id)
.write()?; .write()?;
@ -152,9 +151,6 @@ don't make any changes, then the operation will be aborted.",
(tx.repo_mut().rebase_descendants()?, "") (tx.repo_mut().rebase_descendants()?, "")
}; };
if let Some(mut formatter) = ui.status_formatter() { if let Some(mut formatter) = ui.status_formatter() {
write!(formatter, "Created ")?;
tx.write_commit_summary(formatter.as_mut(), &new_commit)?;
writeln!(formatter)?;
if num_rebased > 0 { if num_rebased > 0 {
writeln!( writeln!(
formatter, formatter,

View File

@ -161,12 +161,11 @@ pub(crate) fn cmd_restore(
writeln!(ui.status(), "Nothing changed.")?; writeln!(ui.status(), "Nothing changed.")?;
} else { } else {
let mut tx = workspace_command.start_transaction(); let mut tx = workspace_command.start_transaction();
let new_commit = tx tx.repo_mut()
.repo_mut()
.rewrite_commit(&to_commit) .rewrite_commit(&to_commit)
.set_tree_id(new_tree_id) .set_tree_id(new_tree_id)
.write()?; .write()?;
// rebase_descendants early; otherwise `new_commit` would always have // rebase_descendants early; otherwise the new commit would always have
// a conflicted change id at this point. // a conflicted change id at this point.
let (num_rebased, extra_msg) = if args.restore_descendants { let (num_rebased, extra_msg) = if args.restore_descendants {
( (
@ -177,9 +176,6 @@ pub(crate) fn cmd_restore(
(tx.repo_mut().rebase_descendants()?, "") (tx.repo_mut().rebase_descendants()?, "")
}; };
if let Some(mut formatter) = ui.status_formatter() { if let Some(mut formatter) = ui.status_formatter() {
write!(formatter, "Created ")?;
tx.write_commit_summary(formatter.as_mut(), &new_commit)?;
writeln!(formatter)?;
if num_rebased > 0 { if num_rebased > 0 {
writeln!( writeln!(
formatter, formatter,

View File

@ -124,7 +124,6 @@ fn test_diffedit() {
let output = work_dir.run_jj(["diffedit"]); let output = work_dir.run_jj(["diffedit"]);
insta::assert_snapshot!(output, @r" insta::assert_snapshot!(output, @r"
------- stderr ------- ------- stderr -------
Created kkmpptxz cbc7a725 (no description set)
Working copy (@) now at: kkmpptxz cbc7a725 (no description set) Working copy (@) now at: kkmpptxz cbc7a725 (no description set)
Parent commit (@-) : rlvkpnrz a72506cd (no description set) Parent commit (@-) : rlvkpnrz a72506cd (no description set)
Added 0 files, modified 1 files, removed 0 files Added 0 files, modified 1 files, removed 0 files
@ -142,7 +141,6 @@ fn test_diffedit() {
let output = work_dir.run_jj(["diffedit", "-r", "@-"]); let output = work_dir.run_jj(["diffedit", "-r", "@-"]);
insta::assert_snapshot!(output, @r" insta::assert_snapshot!(output, @r"
------- stderr ------- ------- stderr -------
Created rlvkpnrz d4eef3fc (no description set)
Rebased 1 descendant commits Rebased 1 descendant commits
Working copy (@) now at: kkmpptxz 59ef1b95 (no description set) Working copy (@) now at: kkmpptxz 59ef1b95 (no description set)
Parent commit (@-) : rlvkpnrz d4eef3fc (no description set) Parent commit (@-) : rlvkpnrz d4eef3fc (no description set)
@ -162,7 +160,6 @@ fn test_diffedit() {
let output = work_dir.run_jj(["diffedit", "--from", "@--"]); let output = work_dir.run_jj(["diffedit", "--from", "@--"]);
insta::assert_snapshot!(output, @r" insta::assert_snapshot!(output, @r"
------- stderr ------- ------- stderr -------
Created kkmpptxz 5b585bd1 (no description set)
Working copy (@) now at: kkmpptxz 5b585bd1 (no description set) Working copy (@) now at: kkmpptxz 5b585bd1 (no description set)
Parent commit (@-) : rlvkpnrz a72506cd (no description set) Parent commit (@-) : rlvkpnrz a72506cd (no description set)
Added 0 files, modified 0 files, removed 1 files Added 0 files, modified 0 files, removed 1 files
@ -212,7 +209,6 @@ fn test_diffedit_new_file() {
let output = work_dir.run_jj(["diffedit"]); let output = work_dir.run_jj(["diffedit"]);
insta::assert_snapshot!(output, @r" insta::assert_snapshot!(output, @r"
------- stderr ------- ------- stderr -------
Created rlvkpnrz b0376e2b (no description set)
Working copy (@) now at: rlvkpnrz b0376e2b (no description set) Working copy (@) now at: rlvkpnrz b0376e2b (no description set)
Parent commit (@-) : qpvuntsm b739eb46 (no description set) Parent commit (@-) : qpvuntsm b739eb46 (no description set)
Added 1 files, modified 0 files, removed 0 files Added 1 files, modified 0 files, removed 0 files
@ -338,7 +334,6 @@ fn test_diffedit_external_tool_conflict_marker_style() {
let output = work_dir.run_jj(["diffedit"]); let output = work_dir.run_jj(["diffedit"]);
insta::assert_snapshot!(output, @r" insta::assert_snapshot!(output, @r"
------- stderr ------- ------- stderr -------
Created mzvwutvl fb39e804 (conflict) (empty) (no description set)
Working copy (@) now at: mzvwutvl fb39e804 (conflict) (empty) (no description set) Working copy (@) now at: mzvwutvl fb39e804 (conflict) (empty) (no description set)
Parent commit (@-) : rlvkpnrz 3765cc27 side-a Parent commit (@-) : rlvkpnrz 3765cc27 side-a
Parent commit (@-) : zsuskuln 8b3de837 side-b Parent commit (@-) : zsuskuln 8b3de837 side-b
@ -487,7 +482,6 @@ fn test_diffedit_3pane() {
let output = work_dir.run_jj(["diffedit", "--config", config_with_output_as_after]); let output = work_dir.run_jj(["diffedit", "--config", config_with_output_as_after]);
insta::assert_snapshot!(output, @r" insta::assert_snapshot!(output, @r"
------- stderr ------- ------- stderr -------
Created kkmpptxz ed8aada3 (no description set)
Working copy (@) now at: kkmpptxz ed8aada3 (no description set) Working copy (@) now at: kkmpptxz ed8aada3 (no description set)
Parent commit (@-) : rlvkpnrz a72506cd (no description set) Parent commit (@-) : rlvkpnrz a72506cd (no description set)
Added 0 files, modified 1 files, removed 0 files Added 0 files, modified 1 files, removed 0 files
@ -505,7 +499,6 @@ fn test_diffedit_3pane() {
let output = work_dir.run_jj(["diffedit", "--config", config_with_output_as_after]); let output = work_dir.run_jj(["diffedit", "--config", config_with_output_as_after]);
insta::assert_snapshot!(output, @r" insta::assert_snapshot!(output, @r"
------- stderr ------- ------- stderr -------
Created kkmpptxz 7c19e689 (no description set)
Working copy (@) now at: kkmpptxz 7c19e689 (no description set) Working copy (@) now at: kkmpptxz 7c19e689 (no description set)
Parent commit (@-) : rlvkpnrz a72506cd (no description set) Parent commit (@-) : rlvkpnrz a72506cd (no description set)
Added 1 files, modified 0 files, removed 0 files Added 1 files, modified 0 files, removed 0 files
@ -579,7 +572,6 @@ fn test_diffedit_merge() {
let output = work_dir.run_jj(["diffedit", "-r", "@-"]); let output = work_dir.run_jj(["diffedit", "-r", "@-"]);
insta::assert_snapshot!(output, @r" insta::assert_snapshot!(output, @r"
------- stderr ------- ------- stderr -------
Created royxmykx 0105de4a (conflict) merge
Rebased 1 descendant commits Rebased 1 descendant commits
Working copy (@) now at: yqosqzyt abbb78c1 (conflict) (empty) (no description set) Working copy (@) now at: yqosqzyt abbb78c1 (conflict) (empty) (no description set)
Parent commit (@-) : royxmykx 0105de4a (conflict) merge Parent commit (@-) : royxmykx 0105de4a (conflict) merge
@ -660,7 +652,6 @@ fn test_diffedit_old_restore_interactive_tests() {
let output = work_dir.run_jj(["diffedit", "--from", "@-"]); let output = work_dir.run_jj(["diffedit", "--from", "@-"]);
insta::assert_snapshot!(output, @r" insta::assert_snapshot!(output, @r"
------- stderr ------- ------- stderr -------
Created rlvkpnrz 69811eda (no description set)
Working copy (@) now at: rlvkpnrz 69811eda (no description set) Working copy (@) now at: rlvkpnrz 69811eda (no description set)
Parent commit (@-) : qpvuntsm fc687cb8 (no description set) Parent commit (@-) : qpvuntsm fc687cb8 (no description set)
Added 0 files, modified 1 files, removed 1 files Added 0 files, modified 1 files, removed 1 files
@ -678,7 +669,6 @@ fn test_diffedit_old_restore_interactive_tests() {
let output = work_dir.run_jj(["diffedit", "--from", "@-"]); let output = work_dir.run_jj(["diffedit", "--from", "@-"]);
insta::assert_snapshot!(output, @r" insta::assert_snapshot!(output, @r"
------- stderr ------- ------- stderr -------
Created rlvkpnrz 2b76a42e (no description set)
Working copy (@) now at: rlvkpnrz 2b76a42e (no description set) Working copy (@) now at: rlvkpnrz 2b76a42e (no description set)
Parent commit (@-) : qpvuntsm fc687cb8 (no description set) Parent commit (@-) : qpvuntsm fc687cb8 (no description set)
Added 0 files, modified 1 files, removed 0 files Added 0 files, modified 1 files, removed 0 files
@ -729,7 +719,6 @@ fn test_diffedit_restore_descendants() {
let output = work_dir.run_jj(["diffedit", "-r", "@-", "--restore-descendants"]); let output = work_dir.run_jj(["diffedit", "-r", "@-", "--restore-descendants"]);
insta::assert_snapshot!(output, @r" insta::assert_snapshot!(output, @r"
------- stderr ------- ------- stderr -------
Created rlvkpnrz 62b8c2ce (no description set)
Rebased 1 descendant commits (while preserving their content) Rebased 1 descendant commits (while preserving their content)
Working copy (@) now at: kkmpptxz 321d1cd1 (no description set) Working copy (@) now at: kkmpptxz 321d1cd1 (no description set)
Parent commit (@-) : rlvkpnrz 62b8c2ce (no description set) Parent commit (@-) : rlvkpnrz 62b8c2ce (no description set)

View File

@ -46,7 +46,6 @@ fn test_restore() {
let output = work_dir.run_jj(["restore"]); let output = work_dir.run_jj(["restore"]);
insta::assert_snapshot!(output, @r" insta::assert_snapshot!(output, @r"
------- stderr ------- ------- stderr -------
Created kkmpptxz 370d81ea (empty) (no description set)
Working copy (@) now at: kkmpptxz 370d81ea (empty) (no description set) Working copy (@) now at: kkmpptxz 370d81ea (empty) (no description set)
Parent commit (@-) : rlvkpnrz ef160660 (no description set) Parent commit (@-) : rlvkpnrz ef160660 (no description set)
Added 1 files, modified 1 files, removed 1 files Added 1 files, modified 1 files, removed 1 files
@ -65,7 +64,6 @@ fn test_restore() {
let output = work_dir.run_jj(["restore", "-c=@-"]); let output = work_dir.run_jj(["restore", "-c=@-"]);
insta::assert_snapshot!(output, @r" insta::assert_snapshot!(output, @r"
------- stderr ------- ------- stderr -------
Created rlvkpnrz b9b6011e (empty) (no description set)
Rebased 1 descendant commits Rebased 1 descendant commits
Working copy (@) now at: kkmpptxz 5b361547 (conflict) (no description set) Working copy (@) now at: kkmpptxz 5b361547 (conflict) (no description set)
Parent commit (@-) : rlvkpnrz b9b6011e (empty) (no description set) Parent commit (@-) : rlvkpnrz b9b6011e (empty) (no description set)
@ -89,7 +87,6 @@ fn test_restore() {
let output = work_dir.run_jj(["restore", "--from", "@--"]); let output = work_dir.run_jj(["restore", "--from", "@--"]);
insta::assert_snapshot!(output, @r" insta::assert_snapshot!(output, @r"
------- stderr ------- ------- stderr -------
Created kkmpptxz 1154634b (no description set)
Working copy (@) now at: kkmpptxz 1154634b (no description set) Working copy (@) now at: kkmpptxz 1154634b (no description set)
Parent commit (@-) : rlvkpnrz ef160660 (no description set) Parent commit (@-) : rlvkpnrz ef160660 (no description set)
Added 1 files, modified 0 files, removed 2 files Added 1 files, modified 0 files, removed 2 files
@ -106,7 +103,6 @@ fn test_restore() {
let output = work_dir.run_jj(["restore", "--into", "@-"]); let output = work_dir.run_jj(["restore", "--into", "@-"]);
insta::assert_snapshot!(output, @r" insta::assert_snapshot!(output, @r"
------- stderr ------- ------- stderr -------
Created rlvkpnrz ad805965 (no description set)
Rebased 1 descendant commits Rebased 1 descendant commits
Working copy (@) now at: kkmpptxz 3fcdcbf2 (empty) (no description set) Working copy (@) now at: kkmpptxz 3fcdcbf2 (empty) (no description set)
Parent commit (@-) : rlvkpnrz ad805965 (no description set) Parent commit (@-) : rlvkpnrz ad805965 (no description set)
@ -127,7 +123,6 @@ fn test_restore() {
let output = work_dir.run_jj(["restore", "--from", "@", "--into", "@-"]); let output = work_dir.run_jj(["restore", "--from", "@", "--into", "@-"]);
insta::assert_snapshot!(output, @r" insta::assert_snapshot!(output, @r"
------- stderr ------- ------- stderr -------
Created rlvkpnrz f256040a (no description set)
Rebased 1 descendant commits Rebased 1 descendant commits
Working copy (@) now at: kkmpptxz 9c6f2083 (empty) (no description set) Working copy (@) now at: kkmpptxz 9c6f2083 (empty) (no description set)
Parent commit (@-) : rlvkpnrz f256040a (no description set) Parent commit (@-) : rlvkpnrz f256040a (no description set)
@ -148,7 +143,6 @@ fn test_restore() {
let output = work_dir.run_jj(["restore", "file2", "file3"]); let output = work_dir.run_jj(["restore", "file2", "file3"]);
insta::assert_snapshot!(output, @r" insta::assert_snapshot!(output, @r"
------- stderr ------- ------- stderr -------
Created kkmpptxz 4ad35a2f (no description set)
Working copy (@) now at: kkmpptxz 4ad35a2f (no description set) Working copy (@) now at: kkmpptxz 4ad35a2f (no description set)
Parent commit (@-) : rlvkpnrz ef160660 (no description set) Parent commit (@-) : rlvkpnrz ef160660 (no description set)
Added 0 files, modified 1 files, removed 1 files Added 0 files, modified 1 files, removed 1 files
@ -212,7 +206,6 @@ fn test_restore_conflicted_merge() {
let output = work_dir.run_jj(["restore", "file"]); let output = work_dir.run_jj(["restore", "file"]);
insta::assert_snapshot!(output, @r" insta::assert_snapshot!(output, @r"
------- stderr ------- ------- stderr -------
Created vruxwmqv 25a37060 conflict | (conflict) (empty) conflict
Working copy (@) now at: vruxwmqv 25a37060 conflict | (conflict) (empty) conflict Working copy (@) now at: vruxwmqv 25a37060 conflict | (conflict) (empty) conflict
Parent commit (@-) : zsuskuln aa493daf a | a Parent commit (@-) : zsuskuln aa493daf a | a
Parent commit (@-) : royxmykx db6a4daf b | b Parent commit (@-) : royxmykx db6a4daf b | b
@ -252,7 +245,6 @@ fn test_restore_conflicted_merge() {
let output = work_dir.run_jj(["restore"]); let output = work_dir.run_jj(["restore"]);
insta::assert_snapshot!(output, @r" insta::assert_snapshot!(output, @r"
------- stderr ------- ------- stderr -------
Created vruxwmqv f2c82b9c conflict | (conflict) (empty) conflict
Working copy (@) now at: vruxwmqv f2c82b9c conflict | (conflict) (empty) conflict Working copy (@) now at: vruxwmqv f2c82b9c conflict | (conflict) (empty) conflict
Parent commit (@-) : zsuskuln aa493daf a | a Parent commit (@-) : zsuskuln aa493daf a | a
Parent commit (@-) : royxmykx db6a4daf b | b Parent commit (@-) : royxmykx db6a4daf b | b
@ -305,7 +297,6 @@ fn test_restore_restore_descendants() {
let output = work_dir.run_jj(["restore", "-c", "b", "file", "--restore-descendants"]); let output = work_dir.run_jj(["restore", "-c", "b", "file", "--restore-descendants"]);
insta::assert_snapshot!(output, @r" insta::assert_snapshot!(output, @r"
------- stderr ------- ------- stderr -------
Created royxmykx 3fd5aa05 b | b
Rebased 1 descendant commits (while preserving their content) Rebased 1 descendant commits (while preserving their content)
Working copy (@) now at: vruxwmqv bf5491a0 ab | ab Working copy (@) now at: vruxwmqv bf5491a0 ab | ab
Parent commit (@-) : zsuskuln aa493daf a | a Parent commit (@-) : zsuskuln aa493daf a | a
@ -386,7 +377,6 @@ fn test_restore_interactive() {
let output = work_dir.run_jj(["restore", "-i", "--from=@-"]); let output = work_dir.run_jj(["restore", "-i", "--from=@-"]);
insta::assert_snapshot!(output, @r" insta::assert_snapshot!(output, @r"
------- stderr ------- ------- stderr -------
Created zsuskuln bccde490 b | b
Working copy (@) now at: zsuskuln bccde490 b | b Working copy (@) now at: zsuskuln bccde490 b | b
Parent commit (@-) : rlvkpnrz 186caaef a | a Parent commit (@-) : rlvkpnrz 186caaef a | a
Added 0 files, modified 1 files, removed 1 files Added 0 files, modified 1 files, removed 1 files
@ -420,7 +410,6 @@ fn test_restore_interactive() {
let output = work_dir.run_jj(["restore", "--tool=fake-diff-editor"]); let output = work_dir.run_jj(["restore", "--tool=fake-diff-editor"]);
insta::assert_snapshot!(output, @r" insta::assert_snapshot!(output, @r"
------- stderr ------- ------- stderr -------
Created zsuskuln 5921de19 b | b
Working copy (@) now at: zsuskuln 5921de19 b | b Working copy (@) now at: zsuskuln 5921de19 b | b
Parent commit (@-) : rlvkpnrz 186caaef a | a Parent commit (@-) : rlvkpnrz 186caaef a | a
Added 0 files, modified 1 files, removed 1 files Added 0 files, modified 1 files, removed 1 files
@ -486,7 +475,6 @@ fn test_restore_interactive_merge() {
let output = work_dir.run_jj(["restore", "-i"]); let output = work_dir.run_jj(["restore", "-i"]);
insta::assert_snapshot!(output, @r" insta::assert_snapshot!(output, @r"
------- stderr ------- ------- stderr -------
Created royxmykx 72e0cbf4 c | c
Working copy (@) now at: royxmykx 72e0cbf4 c | c Working copy (@) now at: royxmykx 72e0cbf4 c | c
Parent commit (@-) : rlvkpnrz 79c1b823 a | a Parent commit (@-) : rlvkpnrz 79c1b823 a | a
Parent commit (@-) : zsuskuln 29e70804 b | b Parent commit (@-) : zsuskuln 29e70804 b | b
@ -561,7 +549,6 @@ fn test_restore_interactive_with_paths() {
let output = work_dir.run_jj(["restore", "-i", "file1", "file2"]); let output = work_dir.run_jj(["restore", "-i", "file1", "file2"]);
insta::assert_snapshot!(output, @r" insta::assert_snapshot!(output, @r"
------- stderr ------- ------- stderr -------
Created zsuskuln 7187da33 b | b
Working copy (@) now at: zsuskuln 7187da33 b | b Working copy (@) now at: zsuskuln 7187da33 b | b
Parent commit (@-) : rlvkpnrz 186caaef a | a Parent commit (@-) : rlvkpnrz 186caaef a | a
Added 0 files, modified 1 files, removed 0 files Added 0 files, modified 1 files, removed 0 files

View File

@ -140,7 +140,6 @@ fn test_snapshot_large_file_restore() {
This will increase the maximum file size allowed for new files, in this repository only. This will increase the maximum file size allowed for new files, in this repository only.
- Run `jj --config snapshot.max-new-file-size=13 st` - Run `jj --config snapshot.max-new-file-size=13 st`
This will increase the maximum file size allowed for new files, for this command only. This will increase the maximum file size allowed for new files, for this command only.
Created kkmpptxz e3eb7e81 (no description set)
Working copy (@) now at: kkmpptxz e3eb7e81 (no description set) Working copy (@) now at: kkmpptxz e3eb7e81 (no description set)
Parent commit (@-) : zzzzzzzz 00000000 (empty) (no description set) Parent commit (@-) : zzzzzzzz 00000000 (empty) (no description set)
Added 1 files, modified 0 files, removed 0 files Added 1 files, modified 0 files, removed 0 files