From 362678e2ef9cd886bd42fae362b1128b21913c43 Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Wed, 12 Jun 2024 14:45:45 +0200 Subject: [PATCH] Mention which command is continued in PromptToContinueRebase When you are in the middle of a rebase, and you cherry-pick a commit which conflicts, it helps to be clear on whether you are prompted to continue the cherry-pick or the rebase. --- pkg/gui/controllers/helpers/merge_and_rebase_helper.go | 2 +- pkg/i18n/english.go | 2 +- pkg/integration/components/common.go | 6 ++++-- pkg/integration/tests/branch/rebase.go | 2 +- pkg/integration/tests/branch/rebase_and_drop.go | 2 +- .../tests/branch/rebase_conflicts_fix_build_errors.go | 2 +- pkg/integration/tests/cherry_pick/cherry_pick_conflicts.go | 2 +- pkg/integration/tests/commit/shared.go | 2 +- pkg/integration/tests/conflicts/resolve_externally.go | 2 +- pkg/integration/tests/conflicts/resolve_multiple_files.go | 2 +- .../tests/conflicts/resolve_without_trailing_lf.go | 2 +- pkg/integration/tests/file/discard_all_dir_changes.go | 2 +- pkg/integration/tests/file/discard_various_changes.go | 2 +- .../tests/file/discard_various_changes_range_select.go | 2 +- .../tests/interactive_rebase/amend_commit_with_conflict.go | 2 +- pkg/integration/tests/interactive_rebase/shared.go | 4 ++-- .../move_to_earlier_commit_from_added_file.go | 2 +- .../move_to_index_from_added_file_with_conflict.go | 2 +- .../tests/patch_building/move_to_index_with_conflict.go | 2 +- pkg/integration/tests/sync/pull_merge_conflict.go | 2 +- pkg/integration/tests/sync/pull_rebase_conflict.go | 2 +- .../tests/sync/pull_rebase_interactive_conflict.go | 2 +- .../tests/sync/pull_rebase_interactive_conflict_drop.go | 2 +- 23 files changed, 27 insertions(+), 25 deletions(-) diff --git a/pkg/gui/controllers/helpers/merge_and_rebase_helper.go b/pkg/gui/controllers/helpers/merge_and_rebase_helper.go index f8c328958..0e63c516f 100644 --- a/pkg/gui/controllers/helpers/merge_and_rebase_helper.go +++ b/pkg/gui/controllers/helpers/merge_and_rebase_helper.go @@ -226,7 +226,7 @@ func (self *MergeAndRebaseHelper) AbortMergeOrRebaseWithConfirm() error { func (self *MergeAndRebaseHelper) PromptToContinueRebase() error { self.c.Confirm(types.ConfirmOpts{ Title: self.c.Tr.Continue, - Prompt: self.c.Tr.ConflictsResolved, + Prompt: fmt.Sprintf(self.c.Tr.ConflictsResolved, self.c.Git().Status.WorkingTreeState().CommandName()), HandleConfirm: func() error { // By the time we get here, we might have unstaged changes again, // e.g. if the user had to fix build errors after resolving the diff --git a/pkg/i18n/english.go b/pkg/i18n/english.go index f3713e048..aa413c6b5 100644 --- a/pkg/i18n/english.go +++ b/pkg/i18n/english.go @@ -1391,7 +1391,7 @@ func EnglishTranslationSet() *TranslationSet { SecondaryTitle: "Secondary", ReflogCommitsTitle: "Reflog", GlobalTitle: "Global keybindings", - ConflictsResolved: "All merge conflicts resolved. Continue?", + ConflictsResolved: "All merge conflicts resolved. Continue the %s?", Continue: "Continue", UnstagedFilesAfterConflictsResolved: "Files have been modified since conflicts were resolved. Auto-stage them and continue?", Keybindings: "Keybindings", diff --git a/pkg/integration/components/common.go b/pkg/integration/components/common.go index 2033a9442..2d62e9ea3 100644 --- a/pkg/integration/components/common.go +++ b/pkg/integration/components/common.go @@ -1,5 +1,7 @@ package components +import "fmt" + // for running common actions type Common struct { t *TestDriver @@ -43,10 +45,10 @@ func (self *Common) AcknowledgeConflicts() { Confirm() } -func (self *Common) ContinueOnConflictsResolved() { +func (self *Common) ContinueOnConflictsResolved(command string) { self.t.ExpectPopup().Confirmation(). Title(Equals("Continue")). - Content(Contains("All merge conflicts resolved. Continue?")). + Content(Contains(fmt.Sprintf("All merge conflicts resolved. Continue the %s?", command))). Confirm() } diff --git a/pkg/integration/tests/branch/rebase.go b/pkg/integration/tests/branch/rebase.go index c7dc028af..6bc2083c4 100644 --- a/pkg/integration/tests/branch/rebase.go +++ b/pkg/integration/tests/branch/rebase.go @@ -48,7 +48,7 @@ var Rebase = NewIntegrationTest(NewIntegrationTestArgs{ t.Views().Information().Content(Contains("Rebasing")) - t.Common().ContinueOnConflictsResolved() + t.Common().ContinueOnConflictsResolved("rebase") t.Views().Information().Content(DoesNotContain("Rebasing")) diff --git a/pkg/integration/tests/branch/rebase_and_drop.go b/pkg/integration/tests/branch/rebase_and_drop.go index 594ae4854..d6c655cf7 100644 --- a/pkg/integration/tests/branch/rebase_and_drop.go +++ b/pkg/integration/tests/branch/rebase_and_drop.go @@ -77,7 +77,7 @@ var RebaseAndDrop = NewIntegrationTest(NewIntegrationTestArgs{ IsFocused(). PressPrimaryAction() - t.Common().ContinueOnConflictsResolved() + t.Common().ContinueOnConflictsResolved("rebase") t.Views().Information().Content(DoesNotContain("Rebasing")) diff --git a/pkg/integration/tests/branch/rebase_conflicts_fix_build_errors.go b/pkg/integration/tests/branch/rebase_conflicts_fix_build_errors.go index 9cd42cd2e..2ae75dafb 100644 --- a/pkg/integration/tests/branch/rebase_conflicts_fix_build_errors.go +++ b/pkg/integration/tests/branch/rebase_conflicts_fix_build_errors.go @@ -51,7 +51,7 @@ var RebaseConflictsFixBuildErrors = NewIntegrationTest(NewIntegrationTestArgs{ popup := t.ExpectPopup().Confirmation(). Title(Equals("Continue")). - Content(Contains("All merge conflicts resolved. Continue?")) + Content(Contains("All merge conflicts resolved. Continue the rebase?")) // While the popup is showing, fix some build errors t.Shell().UpdateFile("file", "make it compile again") diff --git a/pkg/integration/tests/cherry_pick/cherry_pick_conflicts.go b/pkg/integration/tests/cherry_pick/cherry_pick_conflicts.go index cd968adf8..2f001ebe4 100644 --- a/pkg/integration/tests/cherry_pick/cherry_pick_conflicts.go +++ b/pkg/integration/tests/cherry_pick/cherry_pick_conflicts.go @@ -69,7 +69,7 @@ var CherryPickConflicts = NewIntegrationTest(NewIntegrationTestArgs{ SelectNextItem(). PressPrimaryAction() - t.Common().ContinueOnConflictsResolved() + t.Common().ContinueOnConflictsResolved("rebase") t.Views().Files().IsEmpty() diff --git a/pkg/integration/tests/commit/shared.go b/pkg/integration/tests/commit/shared.go index 072cc8154..b6861f135 100644 --- a/pkg/integration/tests/commit/shared.go +++ b/pkg/integration/tests/commit/shared.go @@ -61,7 +61,7 @@ func doTheRebaseForAmendTests(t *TestDriver, keys config.KeybindingConfig) { t.ExpectPopup().Confirmation(). Title(Equals("Continue")). - Content(Contains("All merge conflicts resolved. Continue?")). + Content(Contains("All merge conflicts resolved. Continue the rebase?")). Cancel() } diff --git a/pkg/integration/tests/conflicts/resolve_externally.go b/pkg/integration/tests/conflicts/resolve_externally.go index a8d717351..ab045f233 100644 --- a/pkg/integration/tests/conflicts/resolve_externally.go +++ b/pkg/integration/tests/conflicts/resolve_externally.go @@ -25,7 +25,7 @@ var ResolveExternally = NewIntegrationTest(NewIntegrationTestArgs{ }). Press(keys.Universal.Refresh) - t.Common().ContinueOnConflictsResolved() + t.Common().ContinueOnConflictsResolved("merge") t.Views().Files(). IsEmpty() diff --git a/pkg/integration/tests/conflicts/resolve_multiple_files.go b/pkg/integration/tests/conflicts/resolve_multiple_files.go index 542a74d54..7dd88e02c 100644 --- a/pkg/integration/tests/conflicts/resolve_multiple_files.go +++ b/pkg/integration/tests/conflicts/resolve_multiple_files.go @@ -51,6 +51,6 @@ var ResolveMultipleFiles = NewIntegrationTest(NewIntegrationTestArgs{ ). PressPrimaryAction() - t.Common().ContinueOnConflictsResolved() + t.Common().ContinueOnConflictsResolved("merge") }, }) diff --git a/pkg/integration/tests/conflicts/resolve_without_trailing_lf.go b/pkg/integration/tests/conflicts/resolve_without_trailing_lf.go index 2af1eac54..3deafb288 100644 --- a/pkg/integration/tests/conflicts/resolve_without_trailing_lf.go +++ b/pkg/integration/tests/conflicts/resolve_without_trailing_lf.go @@ -43,7 +43,7 @@ var ResolveWithoutTrailingLf = NewIntegrationTest(NewIntegrationTestArgs{ t.ExpectPopup().Alert(). Title(Equals("Continue")). - Content(Contains("All merge conflicts resolved. Continue?")). + Content(Contains("All merge conflicts resolved. Continue the merge?")). Cancel() t.Views().Files(). diff --git a/pkg/integration/tests/file/discard_all_dir_changes.go b/pkg/integration/tests/file/discard_all_dir_changes.go index e03818534..6caa3d519 100644 --- a/pkg/integration/tests/file/discard_all_dir_changes.go +++ b/pkg/integration/tests/file/discard_all_dir_changes.go @@ -93,7 +93,7 @@ var DiscardAllDirChanges = NewIntegrationTest(NewIntegrationTestArgs{ Confirm() }). Tap(func() { - t.Common().ContinueOnConflictsResolved() + t.Common().ContinueOnConflictsResolved("merge") t.ExpectPopup().Confirmation(). Title(Equals("Continue")). Content(Contains("Files have been modified since conflicts were resolved. Auto-stage them and continue?")). diff --git a/pkg/integration/tests/file/discard_various_changes.go b/pkg/integration/tests/file/discard_various_changes.go index 0cc188f65..bc68fd218 100644 --- a/pkg/integration/tests/file/discard_various_changes.go +++ b/pkg/integration/tests/file/discard_various_changes.go @@ -53,7 +53,7 @@ var DiscardVariousChanges = NewIntegrationTest(NewIntegrationTestArgs{ t.ExpectPopup().Confirmation(). Title(Equals("Continue")). - Content(Contains("All merge conflicts resolved. Continue?")). + Content(Contains("All merge conflicts resolved. Continue the merge?")). Cancel() discardOneByOne([]statusFile{ diff --git a/pkg/integration/tests/file/discard_various_changes_range_select.go b/pkg/integration/tests/file/discard_various_changes_range_select.go index 403ece7f7..937c50114 100644 --- a/pkg/integration/tests/file/discard_various_changes_range_select.go +++ b/pkg/integration/tests/file/discard_various_changes_range_select.go @@ -40,7 +40,7 @@ var DiscardVariousChangesRangeSelect = NewIntegrationTest(NewIntegrationTestArgs t.ExpectPopup().Confirmation(). Title(Equals("Continue")). - Content(Contains("All merge conflicts resolved. Continue?")). + Content(Contains("All merge conflicts resolved. Continue the merge?")). Cancel() }). Lines( diff --git a/pkg/integration/tests/interactive_rebase/amend_commit_with_conflict.go b/pkg/integration/tests/interactive_rebase/amend_commit_with_conflict.go index 2226b5196..c20ab51e0 100644 --- a/pkg/integration/tests/interactive_rebase/amend_commit_with_conflict.go +++ b/pkg/integration/tests/interactive_rebase/amend_commit_with_conflict.go @@ -60,7 +60,7 @@ var AmendCommitWithConflict = NewIntegrationTest(NewIntegrationTestArgs{ SelectNextItem(). PressPrimaryAction() // pick "4" - t.Common().ContinueOnConflictsResolved() + t.Common().ContinueOnConflictsResolved("rebase") t.Common().AcknowledgeConflicts() diff --git a/pkg/integration/tests/interactive_rebase/shared.go b/pkg/integration/tests/interactive_rebase/shared.go index 2e42c7f76..f34cbd7e2 100644 --- a/pkg/integration/tests/interactive_rebase/shared.go +++ b/pkg/integration/tests/interactive_rebase/shared.go @@ -33,7 +33,7 @@ func handleConflictsFromSwap(t *TestDriver) { SelectNextItem(). PressPrimaryAction() // pick "three" - t.Common().ContinueOnConflictsResolved() + t.Common().ContinueOnConflictsResolved("rebase") t.Common().AcknowledgeConflicts() @@ -56,7 +56,7 @@ func handleConflictsFromSwap(t *TestDriver) { SelectNextItem(). PressPrimaryAction() // pick "two" - t.Common().ContinueOnConflictsResolved() + t.Common().ContinueOnConflictsResolved("rebase") t.Views().Commits(). Focus(). diff --git a/pkg/integration/tests/patch_building/move_to_earlier_commit_from_added_file.go b/pkg/integration/tests/patch_building/move_to_earlier_commit_from_added_file.go index 122be3884..a619128fa 100644 --- a/pkg/integration/tests/patch_building/move_to_earlier_commit_from_added_file.go +++ b/pkg/integration/tests/patch_building/move_to_earlier_commit_from_added_file.go @@ -71,7 +71,7 @@ var MoveToEarlierCommitFromAddedFile = NewIntegrationTest(NewIntegrationTestArgs SelectNextItem(). PressPrimaryAction() // choose the version with all three lines - t.Common().ContinueOnConflictsResolved() + t.Common().ContinueOnConflictsResolved("rebase") t.Views().Commits(). Focus(). diff --git a/pkg/integration/tests/patch_building/move_to_index_from_added_file_with_conflict.go b/pkg/integration/tests/patch_building/move_to_index_from_added_file_with_conflict.go index c7acfcd50..177e76e04 100644 --- a/pkg/integration/tests/patch_building/move_to_index_from_added_file_with_conflict.go +++ b/pkg/integration/tests/patch_building/move_to_index_from_added_file_with_conflict.go @@ -67,7 +67,7 @@ var MoveToIndexFromAddedFileWithConflict = NewIntegrationTest(NewIntegrationTest SelectNextItem(). PressPrimaryAction() - t.Common().ContinueOnConflictsResolved() + t.Common().ContinueOnConflictsResolved("rebase") t.ExpectPopup().Alert(). Title(Equals("Error")). diff --git a/pkg/integration/tests/patch_building/move_to_index_with_conflict.go b/pkg/integration/tests/patch_building/move_to_index_with_conflict.go index 51b6f4766..bdf0765d9 100644 --- a/pkg/integration/tests/patch_building/move_to_index_with_conflict.go +++ b/pkg/integration/tests/patch_building/move_to_index_with_conflict.go @@ -62,7 +62,7 @@ var MoveToIndexWithConflict = NewIntegrationTest(NewIntegrationTestArgs{ ). PressPrimaryAction() - t.Common().ContinueOnConflictsResolved() + t.Common().ContinueOnConflictsResolved("rebase") t.ExpectPopup().Alert(). Title(Equals("Error")). diff --git a/pkg/integration/tests/sync/pull_merge_conflict.go b/pkg/integration/tests/sync/pull_merge_conflict.go index 2161f6abd..45ca39b1f 100644 --- a/pkg/integration/tests/sync/pull_merge_conflict.go +++ b/pkg/integration/tests/sync/pull_merge_conflict.go @@ -60,7 +60,7 @@ var PullMergeConflict = NewIntegrationTest(NewIntegrationTestArgs{ ). PressPrimaryAction() // choose 'content4' - t.Common().ContinueOnConflictsResolved() + t.Common().ContinueOnConflictsResolved("merge") t.Views().Status().Content(Equals("↑2 repo → master")) diff --git a/pkg/integration/tests/sync/pull_rebase_conflict.go b/pkg/integration/tests/sync/pull_rebase_conflict.go index d9541e0ed..1d41b2ac3 100644 --- a/pkg/integration/tests/sync/pull_rebase_conflict.go +++ b/pkg/integration/tests/sync/pull_rebase_conflict.go @@ -61,7 +61,7 @@ var PullRebaseConflict = NewIntegrationTest(NewIntegrationTestArgs{ SelectNextItem(). PressPrimaryAction() // choose 'content4' - t.Common().ContinueOnConflictsResolved() + t.Common().ContinueOnConflictsResolved("rebase") t.Views().Status().Content(Equals("↑1 repo → master")) diff --git a/pkg/integration/tests/sync/pull_rebase_interactive_conflict.go b/pkg/integration/tests/sync/pull_rebase_interactive_conflict.go index bf0fc050b..eb767a1a3 100644 --- a/pkg/integration/tests/sync/pull_rebase_interactive_conflict.go +++ b/pkg/integration/tests/sync/pull_rebase_interactive_conflict.go @@ -74,7 +74,7 @@ var PullRebaseInteractiveConflict = NewIntegrationTest(NewIntegrationTestArgs{ SelectNextItem(). PressPrimaryAction() // choose 'content4' - t.Common().ContinueOnConflictsResolved() + t.Common().ContinueOnConflictsResolved("rebase") t.Views().Status().Content(Equals("↑2 repo → master")) diff --git a/pkg/integration/tests/sync/pull_rebase_interactive_conflict_drop.go b/pkg/integration/tests/sync/pull_rebase_interactive_conflict_drop.go index 3eee12efd..4aff8b4e0 100644 --- a/pkg/integration/tests/sync/pull_rebase_interactive_conflict_drop.go +++ b/pkg/integration/tests/sync/pull_rebase_interactive_conflict_drop.go @@ -83,7 +83,7 @@ var PullRebaseInteractiveConflictDrop = NewIntegrationTest(NewIntegrationTestArg SelectNextItem(). PressPrimaryAction() // choose 'content4' - t.Common().ContinueOnConflictsResolved() + t.Common().ContinueOnConflictsResolved("rebase") t.Views().Status().Content(Equals("↑1 repo → master"))