mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-06-15 00:15:32 +02:00
allow opening merge tool
This commit is contained in:
@ -23,6 +23,14 @@ func (c *GitCommand) CatFile(fileName string) (string, error) {
|
|||||||
return c.OSCommand.CatFile(fileName)
|
return c.OSCommand.CatFile(fileName)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *GitCommand) OpenMergeToolCmd() string {
|
||||||
|
return "git mergetool"
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *GitCommand) OpenMergeTool() error {
|
||||||
|
return c.OSCommand.RunCommand("git mergetool")
|
||||||
|
}
|
||||||
|
|
||||||
// StageFile stages a file
|
// StageFile stages a file
|
||||||
func (c *GitCommand) StageFile(fileName string) error {
|
func (c *GitCommand) StageFile(fileName string) error {
|
||||||
return c.RunCommand("git add -- %s", c.OSCommand.Quote(fileName))
|
return c.RunCommand("git add -- %s", c.OSCommand.Quote(fileName))
|
||||||
|
@ -177,6 +177,7 @@ type KeybindingFilesConfig struct {
|
|||||||
ViewResetOptions string `yaml:"viewResetOptions"`
|
ViewResetOptions string `yaml:"viewResetOptions"`
|
||||||
Fetch string `yaml:"fetch"`
|
Fetch string `yaml:"fetch"`
|
||||||
ToggleTreeView string `yaml:"toggleTreeView"`
|
ToggleTreeView string `yaml:"toggleTreeView"`
|
||||||
|
OpenMergeTool string `yaml:"openMergeTool"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type KeybindingBranchesConfig struct {
|
type KeybindingBranchesConfig struct {
|
||||||
@ -401,6 +402,7 @@ func GetDefaultConfig() *UserConfig {
|
|||||||
ViewResetOptions: "D",
|
ViewResetOptions: "D",
|
||||||
Fetch: "f",
|
Fetch: "f",
|
||||||
ToggleTreeView: "`",
|
ToggleTreeView: "`",
|
||||||
|
OpenMergeTool: "M",
|
||||||
},
|
},
|
||||||
Branches: KeybindingBranchesConfig{
|
Branches: KeybindingBranchesConfig{
|
||||||
CopyPullRequestURL: "<c-y>",
|
CopyPullRequestURL: "<c-y>",
|
||||||
|
@ -879,3 +879,15 @@ func (gui *Gui) handleToggleFileTreeView() error {
|
|||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (gui *Gui) handleOpenMergeTool() error {
|
||||||
|
return gui.ask(askOpts{
|
||||||
|
title: gui.Tr.MergeToolTitle,
|
||||||
|
prompt: gui.Tr.MergeToolPrompt,
|
||||||
|
handleConfirm: func() error {
|
||||||
|
return gui.runSubprocessWithSuspenseAndRefresh(
|
||||||
|
gui.OSCommand.ExecutableFromString(gui.GitCommand.OpenMergeToolCmd()),
|
||||||
|
)
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
@ -514,6 +514,13 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
|
|||||||
Handler: gui.handleToggleFileTreeView,
|
Handler: gui.handleToggleFileTreeView,
|
||||||
Description: gui.Tr.LcToggleTreeView,
|
Description: gui.Tr.LcToggleTreeView,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
ViewName: "files",
|
||||||
|
Contexts: []string{string(FILES_CONTEXT_KEY)},
|
||||||
|
Key: gui.getKey(config.Files.OpenMergeTool),
|
||||||
|
Handler: gui.handleOpenMergeTool,
|
||||||
|
Description: gui.Tr.LcOpenMergeTool,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
ViewName: "branches",
|
ViewName: "branches",
|
||||||
Contexts: []string{string(LOCAL_BRANCHES_CONTEXT_KEY)},
|
Contexts: []string{string(LOCAL_BRANCHES_CONTEXT_KEY)},
|
||||||
@ -1408,6 +1415,13 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
|
|||||||
Handler: gui.handleEscapeMerge,
|
Handler: gui.handleEscapeMerge,
|
||||||
Description: gui.Tr.ReturnToFilesPanel,
|
Description: gui.Tr.ReturnToFilesPanel,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
ViewName: "main",
|
||||||
|
Contexts: []string{string(MAIN_MERGING_CONTEXT_KEY)},
|
||||||
|
Key: gui.getKey(config.Files.OpenMergeTool),
|
||||||
|
Handler: gui.handleOpenMergeTool,
|
||||||
|
Description: gui.Tr.LcOpenMergeTool,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
ViewName: "main",
|
ViewName: "main",
|
||||||
Contexts: []string{string(MAIN_MERGING_CONTEXT_KEY)},
|
Contexts: []string{string(MAIN_MERGING_CONTEXT_KEY)},
|
||||||
|
@ -48,6 +48,7 @@ type TranslationSet struct {
|
|||||||
LcToggleStaged string
|
LcToggleStaged string
|
||||||
LcToggleStagedAll string
|
LcToggleStagedAll string
|
||||||
LcToggleTreeView string
|
LcToggleTreeView string
|
||||||
|
LcOpenMergeTool string
|
||||||
LcRefresh string
|
LcRefresh string
|
||||||
LcPush string
|
LcPush string
|
||||||
LcPull string
|
LcPull string
|
||||||
@ -156,6 +157,8 @@ type TranslationSet struct {
|
|||||||
CouldNotFindBinaryErr string
|
CouldNotFindBinaryErr string
|
||||||
AnonymousReportingTitle string
|
AnonymousReportingTitle string
|
||||||
AnonymousReportingPrompt string
|
AnonymousReportingPrompt string
|
||||||
|
MergeToolTitle string
|
||||||
|
MergeToolPrompt string
|
||||||
IntroPopupMessage string
|
IntroPopupMessage string
|
||||||
GitconfigParseErr string
|
GitconfigParseErr string
|
||||||
LcEditFile string
|
LcEditFile string
|
||||||
@ -683,6 +686,7 @@ func englishTranslationSet() TranslationSet {
|
|||||||
LcToggleStaged: "toggle staged",
|
LcToggleStaged: "toggle staged",
|
||||||
LcToggleStagedAll: "stage/unstage all",
|
LcToggleStagedAll: "stage/unstage all",
|
||||||
LcToggleTreeView: "toggle file tree view",
|
LcToggleTreeView: "toggle file tree view",
|
||||||
|
LcOpenMergeTool: "open external merge tool (git mergetool)",
|
||||||
LcRefresh: "refresh",
|
LcRefresh: "refresh",
|
||||||
LcPush: "push",
|
LcPush: "push",
|
||||||
LcPull: "pull",
|
LcPull: "pull",
|
||||||
@ -791,6 +795,8 @@ func englishTranslationSet() TranslationSet {
|
|||||||
CouldNotFindBinaryErr: "Could not find any binary at {{.url}}",
|
CouldNotFindBinaryErr: "Could not find any binary at {{.url}}",
|
||||||
AnonymousReportingTitle: "Help make lazygit better",
|
AnonymousReportingTitle: "Help make lazygit better",
|
||||||
AnonymousReportingPrompt: "Would you like to enable anonymous reporting data to help improve lazygit? (enter/esc)",
|
AnonymousReportingPrompt: "Would you like to enable anonymous reporting data to help improve lazygit? (enter/esc)",
|
||||||
|
MergeToolTitle: "Merge tool",
|
||||||
|
MergeToolPrompt: "Are you sure you want to open `git mergetool`?",
|
||||||
IntroPopupMessage: englishIntroPopupMessage,
|
IntroPopupMessage: englishIntroPopupMessage,
|
||||||
GitconfigParseErr: `Gogit failed to parse your gitconfig file due to the presence of unquoted '\' characters. Removing these should fix the issue.`,
|
GitconfigParseErr: `Gogit failed to parse your gitconfig file due to the presence of unquoted '\' characters. Removing these should fix the issue.`,
|
||||||
LcEditFile: `edit file`,
|
LcEditFile: `edit file`,
|
||||||
|
Reference in New Issue
Block a user