forked from mirrors/jj
cli: print operation summary on "op restore" as we do for "undo"
This commit is contained in:
parent
b30ce36c55
commit
9551794f19
4 changed files with 21 additions and 7 deletions
|
@ -55,6 +55,12 @@ pub fn cmd_op_restore(
|
|||
&args.what,
|
||||
);
|
||||
tx.repo_mut().set_view(new_view);
|
||||
if let Some(mut formatter) = ui.status_formatter() {
|
||||
write!(formatter, "Restored to operation ")?;
|
||||
let template = tx.base_workspace_helper().operation_summary_template();
|
||||
template.format(&target_op, formatter.as_mut())?;
|
||||
writeln!(formatter)?;
|
||||
}
|
||||
tx.finish(ui, format!("restore to operation {}", target_op.id().hex()))?;
|
||||
|
||||
Ok(())
|
||||
|
|
|
@ -1017,7 +1017,9 @@ fn test_fetch_undo_what() {
|
|||
&["op", "restore", "--what", "repo", &base_operation_id],
|
||||
);
|
||||
insta::assert_snapshot!(stdout, @"");
|
||||
insta::assert_snapshot!(stderr, @"");
|
||||
insta::assert_snapshot!(stderr, @r#"
|
||||
Restored to operation b51416386f26 2001-02-03 04:05:07.000 +07:00 - 2001-02-03 04:05:07.000 +07:00 add workspace 'default'
|
||||
"#);
|
||||
insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r###"
|
||||
b (deleted)
|
||||
@origin: vpupmnsl hidden c7d4bdcb descr_for_b
|
||||
|
@ -1044,7 +1046,9 @@ fn test_fetch_undo_what() {
|
|||
],
|
||||
);
|
||||
insta::assert_snapshot!(stdout, @"");
|
||||
insta::assert_snapshot!(stderr, @"");
|
||||
insta::assert_snapshot!(stderr, @r#"
|
||||
Restored to operation b51416386f26 2001-02-03 04:05:07.000 +07:00 - 2001-02-03 04:05:07.000 +07:00 add workspace 'default'
|
||||
"#);
|
||||
insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r###"
|
||||
newbookmark: qpvuntsm 230dd059 (empty) (no description set)
|
||||
"###);
|
||||
|
|
|
@ -161,7 +161,9 @@ fn test_git_import_undo() {
|
|||
// "git import" can be undone by default.
|
||||
let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["op", "restore", &base_operation_id]);
|
||||
insta::assert_snapshot!(stdout, @"");
|
||||
insta::assert_snapshot!(stderr, @"");
|
||||
insta::assert_snapshot!(stderr, @r#"
|
||||
Restored to operation b51416386f26 2001-02-03 04:05:07.000 +07:00 - 2001-02-03 04:05:07.000 +07:00 add workspace 'default'
|
||||
"#);
|
||||
insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @"");
|
||||
// Try "git import" again, which should re-import the bookmark "a".
|
||||
let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["git", "import"]);
|
||||
|
@ -225,10 +227,11 @@ fn test_git_import_move_export_with_default_undo() {
|
|||
// repo stay where they were.
|
||||
let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["op", "restore", &base_operation_id]);
|
||||
insta::assert_snapshot!(stdout, @"");
|
||||
insta::assert_snapshot!(stderr, @r###"
|
||||
insta::assert_snapshot!(stderr, @r#"
|
||||
Restored to operation b51416386f26 2001-02-03 04:05:07.000 +07:00 - 2001-02-03 04:05:07.000 +07:00 add workspace 'default'
|
||||
Working copy now at: qpvuntsm 230dd059 (empty) (no description set)
|
||||
Parent commit : zzzzzzzz 00000000 (empty) (no description set)
|
||||
"###);
|
||||
"#);
|
||||
insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @"");
|
||||
insta::assert_debug_snapshot!(get_git_repo_refs(&git_repo), @r###"
|
||||
[
|
||||
|
|
|
@ -680,12 +680,13 @@ fn test_rebase_revision_onto_descendant() {
|
|||
// Now, let's rebase onto the descendant merge
|
||||
let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]);
|
||||
insta::assert_snapshot!(stdout, @"");
|
||||
insta::assert_snapshot!(stderr, @r###"
|
||||
insta::assert_snapshot!(stderr, @r#"
|
||||
Restored to operation 0957966a18b4 2001-02-03 04:05:15.000 +07:00 - 2001-02-03 04:05:15.000 +07:00 create bookmark merge pointing to commit b05964d109522cd06e48f1a2661e1a0f58be0984
|
||||
Working copy now at: vruxwmqv b05964d1 merge | merge
|
||||
Parent commit : royxmykx cea87a87 b | b
|
||||
Parent commit : zsuskuln 2c5b7858 a | a
|
||||
Added 1 files, modified 0 files, removed 0 files
|
||||
"###);
|
||||
"#);
|
||||
let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["rebase", "-r", "base", "-d", "merge"]);
|
||||
insta::assert_snapshot!(stdout, @"");
|
||||
insta::assert_snapshot!(stderr, @r###"
|
||||
|
|
Loading…
Reference in a new issue