mirror of
https://github.com/martinvonz/jj.git
synced 2025-01-06 13:13:50 +00:00
test_abandon_command: show change ids in get_log_output
Branches move around a little confusigly with `abandon`. We do want to keep them, to test their behavior, but we can show the change id to make things clearer.
This commit is contained in:
parent
a0cbe7ced0
commit
0634dc5674
1 changed files with 42 additions and 35 deletions
|
@ -43,15 +43,15 @@ fn test_basics() {
|
||||||
create_commit(&test_env, &repo_path, "e", &["a", "d"]);
|
create_commit(&test_env, &repo_path, "e", &["a", "d"]);
|
||||||
// Test the setup
|
// Test the setup
|
||||||
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###"
|
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###"
|
||||||
@ e
|
@ [znk] e
|
||||||
├─╮
|
├─╮
|
||||||
│ ◉ d
|
│ ◉ [vru] d
|
||||||
│ ◉ c
|
│ ◉ [roy] c
|
||||||
│ │ ◉ b
|
│ │ ◉ [zsu] b
|
||||||
├───╯
|
├───╯
|
||||||
◉ │ a
|
◉ │ [rlv] a
|
||||||
├─╯
|
├─╯
|
||||||
◉
|
◉ [zzz]
|
||||||
"###);
|
"###);
|
||||||
|
|
||||||
let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["abandon", "d"]);
|
let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["abandon", "d"]);
|
||||||
|
@ -65,14 +65,14 @@ fn test_basics() {
|
||||||
Added 0 files, modified 0 files, removed 1 files
|
Added 0 files, modified 0 files, removed 1 files
|
||||||
"###);
|
"###);
|
||||||
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###"
|
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###"
|
||||||
@ e
|
@ [znk] e
|
||||||
├─╮
|
├─╮
|
||||||
│ ◉ c d
|
│ ◉ [roy] c d
|
||||||
│ │ ◉ b
|
│ │ ◉ [zsu] b
|
||||||
├───╯
|
├───╯
|
||||||
◉ │ a
|
◉ │ [rlv] a
|
||||||
├─╯
|
├─╯
|
||||||
◉
|
◉ [zzz]
|
||||||
"###);
|
"###);
|
||||||
|
|
||||||
test_env.jj_cmd_ok(&repo_path, &["undo"]);
|
test_env.jj_cmd_ok(&repo_path, &["undo"]);
|
||||||
|
@ -85,14 +85,14 @@ fn test_basics() {
|
||||||
Added 0 files, modified 0 files, removed 3 files
|
Added 0 files, modified 0 files, removed 3 files
|
||||||
"###);
|
"###);
|
||||||
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###"
|
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###"
|
||||||
@
|
@ [nkm]
|
||||||
│ ◉ b
|
│ ◉ [zsu] b
|
||||||
├─╯
|
├─╯
|
||||||
◉ a e??
|
◉ [rlv] a e??
|
||||||
│ ◉ d e??
|
│ ◉ [vru] d e??
|
||||||
│ ◉ c
|
│ ◉ [roy] c
|
||||||
├─╯
|
├─╯
|
||||||
◉
|
◉ [zzz]
|
||||||
"###);
|
"###);
|
||||||
|
|
||||||
// Abandoning `a` would normally result in its descendant merge commit, `e`,
|
// Abandoning `a` would normally result in its descendant merge commit, `e`,
|
||||||
|
@ -109,12 +109,12 @@ fn test_basics() {
|
||||||
Added 0 files, modified 0 files, removed 1 files
|
Added 0 files, modified 0 files, removed 1 files
|
||||||
"###);
|
"###);
|
||||||
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###"
|
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###"
|
||||||
@ e
|
@ [znk] e
|
||||||
◉ d
|
◉ [vru] d
|
||||||
◉ c
|
◉ [roy] c
|
||||||
│ ◉ b
|
│ ◉ [zsu] b
|
||||||
├─╯
|
├─╯
|
||||||
◉ a
|
◉ [zzz] a
|
||||||
"###);
|
"###);
|
||||||
|
|
||||||
test_env.jj_cmd_ok(&repo_path, &["undo"]);
|
test_env.jj_cmd_ok(&repo_path, &["undo"]);
|
||||||
|
@ -130,11 +130,11 @@ fn test_basics() {
|
||||||
Added 0 files, modified 0 files, removed 3 files
|
Added 0 files, modified 0 files, removed 3 files
|
||||||
"###);
|
"###);
|
||||||
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###"
|
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###"
|
||||||
@
|
@ [wvu]
|
||||||
│ ◉ b
|
│ ◉ [zsu] b
|
||||||
├─╯
|
├─╯
|
||||||
◉ a e??
|
◉ [rlv] a e??
|
||||||
◉ c d e??
|
◉ [zzz] c d e??
|
||||||
"###);
|
"###);
|
||||||
|
|
||||||
// Test abandoning the same commit twice directly
|
// Test abandoning the same commit twice directly
|
||||||
|
@ -145,13 +145,13 @@ fn test_basics() {
|
||||||
Abandoned commit zsuskuln 1394f625 b | b
|
Abandoned commit zsuskuln 1394f625 b | b
|
||||||
"###);
|
"###);
|
||||||
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###"
|
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###"
|
||||||
@ e
|
@ [znk] e
|
||||||
├─╮
|
├─╮
|
||||||
│ ◉ d
|
│ ◉ [vru] d
|
||||||
│ ◉ c
|
│ ◉ [roy] c
|
||||||
◉ │ a b
|
◉ │ [rlv] a b
|
||||||
├─╯
|
├─╯
|
||||||
◉
|
◉ [zzz]
|
||||||
"###);
|
"###);
|
||||||
|
|
||||||
// Test abandoning the same commit twice indirectly
|
// Test abandoning the same commit twice indirectly
|
||||||
|
@ -169,10 +169,10 @@ fn test_basics() {
|
||||||
Added 0 files, modified 0 files, removed 4 files
|
Added 0 files, modified 0 files, removed 4 files
|
||||||
"###);
|
"###);
|
||||||
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###"
|
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###"
|
||||||
@
|
@ [oup]
|
||||||
│ ◉ c d e??
|
│ ◉ [roy] c d e??
|
||||||
├─╯
|
├─╯
|
||||||
◉ a b e??
|
◉ [zzz] a b e??
|
||||||
"###);
|
"###);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -213,5 +213,12 @@ fn test_double_abandon() {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_log_output(test_env: &TestEnvironment, repo_path: &Path) -> String {
|
fn get_log_output(test_env: &TestEnvironment, repo_path: &Path) -> String {
|
||||||
test_env.jj_cmd_success(repo_path, &["log", "-T", "branches"])
|
test_env.jj_cmd_success(
|
||||||
|
repo_path,
|
||||||
|
&[
|
||||||
|
"log",
|
||||||
|
"-T",
|
||||||
|
r#"separate(" ", "[" ++ change_id.short(3) ++ "]", branches)"#,
|
||||||
|
],
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue