mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-04-27 12:32:37 +02:00
Add number of commits to cherry-pick confirmation prompt
This commit is contained in:
parent
3518ec9f72
commit
c44231a7d7
@ -1,10 +1,13 @@
|
|||||||
package helpers
|
package helpers
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"strconv"
|
||||||
|
|
||||||
"github.com/jesseduffield/gocui"
|
"github.com/jesseduffield/gocui"
|
||||||
"github.com/jesseduffield/lazygit/pkg/commands/models"
|
"github.com/jesseduffield/lazygit/pkg/commands/models"
|
||||||
"github.com/jesseduffield/lazygit/pkg/gui/modes/cherrypicking"
|
"github.com/jesseduffield/lazygit/pkg/gui/modes/cherrypicking"
|
||||||
"github.com/jesseduffield/lazygit/pkg/gui/types"
|
"github.com/jesseduffield/lazygit/pkg/gui/types"
|
||||||
|
"github.com/jesseduffield/lazygit/pkg/utils"
|
||||||
"github.com/samber/lo"
|
"github.com/samber/lo"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -68,7 +71,11 @@ func (self *CherryPickHelper) CopyRange(commitsList []*models.Commit, context ty
|
|||||||
func (self *CherryPickHelper) Paste() error {
|
func (self *CherryPickHelper) Paste() error {
|
||||||
self.c.Confirm(types.ConfirmOpts{
|
self.c.Confirm(types.ConfirmOpts{
|
||||||
Title: self.c.Tr.CherryPick,
|
Title: self.c.Tr.CherryPick,
|
||||||
Prompt: self.c.Tr.SureCherryPick,
|
Prompt: utils.ResolvePlaceholderString(
|
||||||
|
self.c.Tr.SureCherryPick,
|
||||||
|
map[string]string{
|
||||||
|
"numCommits": strconv.Itoa(len(self.getData().CherryPickedCommits)),
|
||||||
|
}),
|
||||||
HandleConfirm: func() error {
|
HandleConfirm: func() error {
|
||||||
isInRebase, err := self.c.Git().Status.IsInInteractiveRebase()
|
isInRebase, err := self.c.Git().Status.IsInInteractiveRebase()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -1337,7 +1337,7 @@ func EnglishTranslationSet() *TranslationSet {
|
|||||||
CherryPickCopyTooltip: "Mark commit as copied. Then, within the local commits view, you can press `{{.paste}}` to paste (cherry-pick) the copied commit(s) into your checked out branch. At any time you can press `{{.escape}}` to cancel the selection.",
|
CherryPickCopyTooltip: "Mark commit as copied. Then, within the local commits view, you can press `{{.paste}}` to paste (cherry-pick) the copied commit(s) into your checked out branch. At any time you can press `{{.escape}}` to cancel the selection.",
|
||||||
CherryPickCopyRangeTooltip: "Mark commits as copied from the last copied commit to the selected commit.",
|
CherryPickCopyRangeTooltip: "Mark commits as copied from the last copied commit to the selected commit.",
|
||||||
PasteCommits: "Paste (cherry-pick)",
|
PasteCommits: "Paste (cherry-pick)",
|
||||||
SureCherryPick: "Are you sure you want to cherry-pick the copied commits onto this branch?",
|
SureCherryPick: "Are you sure you want to cherry-pick the {{.numCommits}} copied commit(s) onto this branch?",
|
||||||
CherryPick: "Cherry-pick",
|
CherryPick: "Cherry-pick",
|
||||||
CannotCherryPickNonCommit: "Cannot cherry-pick this kind of todo item",
|
CannotCherryPickNonCommit: "Cannot cherry-pick this kind of todo item",
|
||||||
CannotCherryPickMergeCommit: "Cherry-picking merge commits is not supported",
|
CannotCherryPickMergeCommit: "Cherry-picking merge commits is not supported",
|
||||||
|
@ -66,7 +66,7 @@ var CherryPick = NewIntegrationTest(NewIntegrationTestArgs{
|
|||||||
Tap(func() {
|
Tap(func() {
|
||||||
t.ExpectPopup().Alert().
|
t.ExpectPopup().Alert().
|
||||||
Title(Equals("Cherry-pick")).
|
Title(Equals("Cherry-pick")).
|
||||||
Content(Contains("Are you sure you want to cherry-pick the copied commits onto this branch?")).
|
Content(Contains("Are you sure you want to cherry-pick the 2 copied commit(s) onto this branch?")).
|
||||||
Confirm()
|
Confirm()
|
||||||
}).
|
}).
|
||||||
Tap(func() {
|
Tap(func() {
|
||||||
@ -95,7 +95,7 @@ var CherryPick = NewIntegrationTest(NewIntegrationTestArgs{
|
|||||||
Tap(func() {
|
Tap(func() {
|
||||||
t.ExpectPopup().Alert().
|
t.ExpectPopup().Alert().
|
||||||
Title(Equals("Cherry-pick")).
|
Title(Equals("Cherry-pick")).
|
||||||
Content(Contains("Are you sure you want to cherry-pick the copied commits onto this branch?")).
|
Content(Contains("Are you sure you want to cherry-pick the 2 copied commit(s) onto this branch?")).
|
||||||
Confirm()
|
Confirm()
|
||||||
}).
|
}).
|
||||||
Tap(func() {
|
Tap(func() {
|
||||||
|
@ -49,7 +49,7 @@ var CherryPickConflicts = NewIntegrationTest(NewIntegrationTestArgs{
|
|||||||
|
|
||||||
t.ExpectPopup().Alert().
|
t.ExpectPopup().Alert().
|
||||||
Title(Equals("Cherry-pick")).
|
Title(Equals("Cherry-pick")).
|
||||||
Content(Contains("Are you sure you want to cherry-pick the copied commits onto this branch?")).
|
Content(Contains("Are you sure you want to cherry-pick the 2 copied commit(s) onto this branch?")).
|
||||||
Confirm()
|
Confirm()
|
||||||
|
|
||||||
t.Common().AcknowledgeConflicts()
|
t.Common().AcknowledgeConflicts()
|
||||||
|
@ -67,7 +67,7 @@ var CherryPickDuringRebase = NewIntegrationTest(NewIntegrationTestArgs{
|
|||||||
Tap(func() {
|
Tap(func() {
|
||||||
t.ExpectPopup().Alert().
|
t.ExpectPopup().Alert().
|
||||||
Title(Equals("Cherry-pick")).
|
Title(Equals("Cherry-pick")).
|
||||||
Content(Contains("Are you sure you want to cherry-pick the copied commits onto this branch?")).
|
Content(Contains("Are you sure you want to cherry-pick the 1 copied commit(s) onto this branch?")).
|
||||||
Confirm()
|
Confirm()
|
||||||
}).
|
}).
|
||||||
Tap(func() {
|
Tap(func() {
|
||||||
|
@ -63,7 +63,7 @@ var CherryPickRange = NewIntegrationTest(NewIntegrationTestArgs{
|
|||||||
Tap(func() {
|
Tap(func() {
|
||||||
t.ExpectPopup().Alert().
|
t.ExpectPopup().Alert().
|
||||||
Title(Equals("Cherry-pick")).
|
Title(Equals("Cherry-pick")).
|
||||||
Content(Contains("Are you sure you want to cherry-pick the copied commits onto this branch?")).
|
Content(Contains("Are you sure you want to cherry-pick the 2 copied commit(s) onto this branch?")).
|
||||||
Confirm()
|
Confirm()
|
||||||
}).
|
}).
|
||||||
Tap(func() {
|
Tap(func() {
|
||||||
|
@ -71,7 +71,7 @@ var CherryPick = NewIntegrationTest(NewIntegrationTestArgs{
|
|||||||
t.Wait(1000)
|
t.Wait(1000)
|
||||||
t.ExpectPopup().Alert().
|
t.ExpectPopup().Alert().
|
||||||
Title(Equals("Cherry-pick")).
|
Title(Equals("Cherry-pick")).
|
||||||
Content(Contains("Are you sure you want to cherry-pick the copied commits onto this branch?")).
|
Content(Contains("Are you sure you want to cherry-pick the 2 copied commit(s) onto this branch?")).
|
||||||
Confirm()
|
Confirm()
|
||||||
}).
|
}).
|
||||||
TopLines(
|
TopLines(
|
||||||
|
@ -39,7 +39,7 @@ var CherryPick = NewIntegrationTest(NewIntegrationTestArgs{
|
|||||||
Tap(func() {
|
Tap(func() {
|
||||||
t.ExpectPopup().Alert().
|
t.ExpectPopup().Alert().
|
||||||
Title(Equals("Cherry-pick")).
|
Title(Equals("Cherry-pick")).
|
||||||
Content(Contains("Are you sure you want to cherry-pick the copied commits onto this branch?")).
|
Content(Contains("Are you sure you want to cherry-pick the 1 copied commit(s) onto this branch?")).
|
||||||
Confirm()
|
Confirm()
|
||||||
}).
|
}).
|
||||||
Lines(
|
Lines(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user