From 1733ae22c7be2ac7c0f9a72c9f66525512f5f514 Mon Sep 17 00:00:00 2001 From: Ilya Grigoriev Date: Mon, 7 Aug 2023 14:45:01 -0700 Subject: [PATCH] cli templates: include info on divergent change ids in short commit template Fixes #2411 --- cli/src/config/templates.toml | 12 ++---------- cli/tests/test_checkout.rs | 4 ++-- cli/tests/test_undo.rs | 18 +++++++++--------- cli/tests/test_workspaces.rs | 2 +- 4 files changed, 14 insertions(+), 22 deletions(-) diff --git a/cli/src/config/templates.toml b/cli/src/config/templates.toml index f8c06bce7..00ea214e1 100644 --- a/cli/src/config/templates.toml +++ b/cli/src/config/templates.toml @@ -1,11 +1,7 @@ [templates] commit_summary = ''' separate(" ", - label( - if(hidden, "hidden"), - separate(" ", - format_short_change_id(change_id), - if(hidden, "hidden"))), + builtin_change_id_with_hidden_and_divergent_info, format_short_commit_id(commit_id), separate(commit_summary_separator, branches, @@ -20,11 +16,7 @@ separate(" ", commit_summary_no_branches = ''' separate(" ", - label( - if(hidden, "hidden"), - separate(" ", - format_short_change_id(change_id), - if(hidden, "hidden"))), + builtin_change_id_with_hidden_and_divergent_info, format_short_commit_id(commit_id), if(conflict, label("conflict", "(conflict)")), if(empty, label("empty", "(empty)")), diff --git a/cli/tests/test_checkout.rs b/cli/tests/test_checkout.rs index 0af94cd3f..c184bb6a4 100644 --- a/cli/tests/test_checkout.rs +++ b/cli/tests/test_checkout.rs @@ -152,8 +152,8 @@ fn test_checkout_conflicting_change_ids() { insta::assert_snapshot!(stderr, @r###" Error: Revset "qpvuntsm" resolved to more than one revision Hint: The revset "qpvuntsm" resolved to these revisions: - qpvuntsm d2ae6806 (empty) two - qpvuntsm a9330854 (empty) one + qpvuntsm?? d2ae6806 (empty) two + qpvuntsm?? a9330854 (empty) one Some of these commits have the same change id. Abandon one of them with `jj abandon -r `. "###); } diff --git a/cli/tests/test_undo.rs b/cli/tests/test_undo.rs index 6d492fd02..ba961a265 100644 --- a/cli/tests/test_undo.rs +++ b/cli/tests/test_undo.rs @@ -112,10 +112,10 @@ fn test_git_push_undo() { // git fetch && jj undo && jj git fetch` would become a no-op. insta::assert_snapshot!(get_branch_output(&test_env, &repo_path), @r###" main (conflicted): - - qpvuntsm hidden 0cffb614 (empty) AA - + qpvuntsm 0a3e99f0 (empty) CC - + qpvuntsm 8c05de15 (empty) BB - @origin (behind by 1 commits): qpvuntsm 8c05de15 (empty) BB + - qpvuntsm?? hidden 0cffb614 (empty) AA + + qpvuntsm?? 0a3e99f0 (empty) CC + + qpvuntsm?? 8c05de15 (empty) BB + @origin (behind by 1 commits): qpvuntsm?? 8c05de15 (empty) BB "###); } @@ -270,11 +270,11 @@ fn test_git_push_undo_colocated() { // same result in a seemingly different way? insta::assert_snapshot!(get_branch_output(&test_env, &repo_path), @r###" main (conflicted): - - qpvuntsm hidden 0cffb614 (empty) AA - + qpvuntsm 0a3e99f0 (empty) CC - + qpvuntsm 8c05de15 (empty) BB - @git (behind by 1 commits): qpvuntsm 0a3e99f0 (empty) CC - @origin (behind by 1 commits): qpvuntsm 8c05de15 (empty) BB + - qpvuntsm?? hidden 0cffb614 (empty) AA + + qpvuntsm?? 0a3e99f0 (empty) CC + + qpvuntsm?? 8c05de15 (empty) BB + @git (behind by 1 commits): qpvuntsm?? 0a3e99f0 (empty) CC + @origin (behind by 1 commits): qpvuntsm?? 8c05de15 (empty) BB "###); } diff --git a/cli/tests/test_workspaces.rs b/cli/tests/test_workspaces.rs index c2c856a30..03fec2b0c 100644 --- a/cli/tests/test_workspaces.rs +++ b/cli/tests/test_workspaces.rs @@ -193,7 +193,7 @@ fn test_workspaces_conflicting_edits() { insta::assert_snapshot!(stderr, @r###" Concurrent modification detected, resolving automatically. Rebased 1 descendant commits onto commits rewritten by other operation - Working copy now at: pmmvwywv a1896a17 (empty) (no description set) + Working copy now at: pmmvwywv?? a1896a17 (empty) (no description set) Added 0 files, modified 1 files, removed 0 files "###); insta::assert_snapshot!(get_log_output(&test_env, &secondary_path),