From af8d362caabee3bbf220ce0a9a58e7c4493cb2bb Mon Sep 17 00:00:00 2001 From: Naveen Vardhi Date: Sat, 6 Oct 2018 17:04:33 +0530 Subject: [PATCH 1/6] Initial version of delete named branch added --- pkg/gui/branches_panel.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/pkg/gui/branches_panel.go b/pkg/gui/branches_panel.go index 0f66533b1..5c33156be 100644 --- a/pkg/gui/branches_panel.go +++ b/pkg/gui/branches_panel.go @@ -76,6 +76,10 @@ func (gui *Gui) deleteBranch(g *gocui.Gui, v *gocui.View, force bool) error { if checkedOutBranch.Name == selectedBranch.Name { return gui.createErrorPanel(g, gui.Tr.SLocalize("CantDeleteCheckOutBranch")) } + return gui.deleteNamedBranch(g, v, selectedBranch, force) +} + +func (gui *Gui) deleteNamedBranch(g *gocui.Gui, v *gocui.View, selectedBranch *commands.Branch, force bool) error { title := gui.Tr.SLocalize("DeleteBranch") var messageId string if force { @@ -91,7 +95,12 @@ func (gui *Gui) deleteBranch(g *gocui.Gui, v *gocui.View, force bool) error { ) return gui.createConfirmationPanel(g, v, title, message, func(g *gocui.Gui, v *gocui.View) error { if err := gui.GitCommand.DeleteBranch(selectedBranch.Name, force); err != nil { - return gui.createErrorPanel(g, err.Error()) + errMessage := err.Error() + if !force && strings.Contains(errMessage, "is not fully merged") { + return gui.deleteNamedBranch(g, v, selectedBranch, true) + } else { + return gui.createErrorPanel(g, errMessage) + } } return gui.refreshSidePanels(g) }, nil) From df0e3e52fea02950d78af5233a859f592092d475 Mon Sep 17 00:00:00 2001 From: Kristijan Husak Date: Fri, 12 Oct 2018 14:06:03 +0200 Subject: [PATCH 2/6] Add option to create pull request form branches panel. --- pkg/commands/git.go | 6 ++ pkg/commands/pull_request.go | 101 ++++++++++++++++++++ pkg/commands/pull_request_test.go | 151 ++++++++++++++++++++++++++++++ pkg/gui/branches_panel.go | 11 +++ pkg/gui/keybindings.go | 6 ++ pkg/i18n/dutch.go | 6 ++ pkg/i18n/english.go | 6 ++ pkg/i18n/polish.go | 6 ++ 8 files changed, 293 insertions(+) create mode 100644 pkg/commands/pull_request.go create mode 100644 pkg/commands/pull_request_test.go diff --git a/pkg/commands/git.go b/pkg/commands/git.go index 0e974b567..9764d75d7 100644 --- a/pkg/commands/git.go +++ b/pkg/commands/git.go @@ -555,6 +555,12 @@ func (c *GitCommand) Show(sha string) (string, error) { return c.OSCommand.RunCommandWithOutput(fmt.Sprintf("git show --color %s", sha)) } +// GetRemoteURL returns current repo remote url +func (c *GitCommand) GetRemoteURL() string { + url, _ := c.OSCommand.RunCommandWithOutput("git config --get remote.origin.url") + return utils.TrimTrailingNewline(url) +} + // Diff returns the diff of a file func (c *GitCommand) Diff(file *File) string { cachedArg := "" diff --git a/pkg/commands/pull_request.go b/pkg/commands/pull_request.go new file mode 100644 index 000000000..4eb030042 --- /dev/null +++ b/pkg/commands/pull_request.go @@ -0,0 +1,101 @@ +package commands + +import ( + "errors" + "fmt" + "regexp" + "strings" +) + +// Service is a service that repository is on (Github, Bitbucket, ...) +type Service struct { + Name string + PullRequestURL string +} + +// PullRequest opens a link in browser to create new pull request +// with selected branch +type PullRequest struct { + GitServices []*Service + GitCommand *GitCommand +} + +// RepoInformation holds some basic information about the repo +type RepoInformation struct { + Owner string + Repository string +} + +func getServices() []*Service { + return []*Service{ + { + Name: "github.com", + PullRequestURL: "https://github.com/%s/%s/compare/%s?expand=1", + }, + { + Name: "bitbucket.org", + PullRequestURL: "https://bitbucket.org/%s/%s/pull-requests/new?t=%s", + }, + { + Name: "gitlab.com", + PullRequestURL: "https://gitlab.com/%s/%s/merge_requests/new?merge_request[source_branch]=%s", + }, + } +} + +// NewPullRequest creates new instance of PullRequest +func NewPullRequest(gitCommand *GitCommand) (*PullRequest, error) { + return &PullRequest{ + GitServices: getServices(), + GitCommand: gitCommand, + }, nil +} + +// Create opens link to new pull request in browser +func (pr *PullRequest) Create(branch *Branch) error { + repoURL := pr.GitCommand.GetRemoteURL() + var gitService *Service + + for _, service := range pr.GitServices { + if strings.Contains(repoURL, service.Name) { + gitService = service + break + } + } + + if gitService == nil { + return errors.New(pr.GitCommand.Tr.SLocalize("UnsupportedGitService")) + } + + repoInfo := getRepoInfoFromURL(repoURL) + + return pr.GitCommand.OSCommand.OpenFile(fmt.Sprintf( + gitService.PullRequestURL, repoInfo.Owner, repoInfo.Repository, branch.Name, + )) +} + +func getRepoInfoFromURL(url string) *RepoInformation { + isHTTP := strings.HasPrefix(url, "http") + removeGitExtension := regexp.MustCompile(`\.git$`) + + if isHTTP { + splits := strings.Split(url, "/") + owner := splits[len(splits)-2] + repo := removeGitExtension.ReplaceAllString(splits[len(splits)-1], "") + + return &RepoInformation{ + Owner: owner, + Repository: repo, + } + } + + tmpSplit := strings.Split(url, ":") + splits := strings.Split(tmpSplit[1], "/") + owner := splits[0] + repo := removeGitExtension.ReplaceAllString(splits[1], "") + + return &RepoInformation{ + Owner: owner, + Repository: repo, + } +} diff --git a/pkg/commands/pull_request_test.go b/pkg/commands/pull_request_test.go new file mode 100644 index 000000000..8173edc71 --- /dev/null +++ b/pkg/commands/pull_request_test.go @@ -0,0 +1,151 @@ +package commands + +import ( + "github.com/stretchr/testify/assert" + "os/exec" + "strings" + "testing" +) + +func TestGetRepoInfoFromURL(t *testing.T) { + type scenario struct { + testName string + repoURL string + test func(*RepoInformation) + } + + scenarios := []scenario{ + { + "Returns repository information for git remote url", + "git@github.com:petersmith/super_calculator", + func(repoInfo *RepoInformation) { + assert.EqualValues(t, repoInfo.Owner, "petersmith") + assert.EqualValues(t, repoInfo.Repository, "super_calculator") + }, + }, + { + "Returns repository information for http remote url", + "https://my_username@bitbucket.org/johndoe/social_network.git", + func(repoInfo *RepoInformation) { + assert.EqualValues(t, repoInfo.Owner, "johndoe") + assert.EqualValues(t, repoInfo.Repository, "social_network") + }, + }, + } + + for _, s := range scenarios { + t.Run(s.testName, func(t *testing.T) { + s.test(getRepoInfoFromURL(s.repoURL)) + }) + } +} + +func TestCreatePullRequest(t *testing.T) { + type scenario struct { + testName string + branch *Branch + command func(string, ...string) *exec.Cmd + test func(err error) + } + + scenarios := []scenario{ + { + "Opens a link to new pull request on bitbucket", + &Branch{ + Name: "feature/profile-page", + }, + func(cmd string, args ...string) *exec.Cmd { + // Handle git remote url call + if strings.HasPrefix(cmd, "git") { + return exec.Command("echo", "git@bitbucket.org:johndoe/social_network.git") + } + + assert.Equal(t, cmd, "open") + assert.Equal(t, args, []string{"https://bitbucket.org/johndoe/social_network/pull-requests/new?t=feature/profile-page"}) + return exec.Command("echo") + }, + func(err error) { + assert.NoError(t, err) + }, + }, + { + "Opens a link to new pull request on bitbucket with http remote url", + &Branch{ + Name: "feature/events", + }, + func(cmd string, args ...string) *exec.Cmd { + // Handle git remote url call + if strings.HasPrefix(cmd, "git") { + return exec.Command("echo", "https://my_username@bitbucket.org/johndoe/social_network.git") + } + + assert.Equal(t, cmd, "open") + assert.Equal(t, args, []string{"https://bitbucket.org/johndoe/social_network/pull-requests/new?t=feature/events"}) + return exec.Command("echo") + }, + func(err error) { + assert.NoError(t, err) + }, + }, + { + "Opens a link to new pull request on github", + &Branch{ + Name: "feature/sum-operation", + }, + func(cmd string, args ...string) *exec.Cmd { + // Handle git remote url call + if strings.HasPrefix(cmd, "git") { + return exec.Command("echo", "git@github.com:peter/calculator.git") + } + + assert.Equal(t, cmd, "open") + assert.Equal(t, args, []string{"https://github.com/peter/calculator/compare/feature/sum-operation?expand=1"}) + return exec.Command("echo") + }, + func(err error) { + assert.NoError(t, err) + }, + }, + { + "Opens a link to new pull request on gitlab", + &Branch{ + Name: "feature/ui", + }, + func(cmd string, args ...string) *exec.Cmd { + // Handle git remote url call + if strings.HasPrefix(cmd, "git") { + return exec.Command("echo", "git@gitlab.com:peter/calculator.git") + } + + assert.Equal(t, cmd, "open") + assert.Equal(t, args, []string{"https://gitlab.com/peter/calculator/merge_requests/new?merge_request[source_branch]=feature/ui"}) + return exec.Command("echo") + }, + func(err error) { + assert.NoError(t, err) + }, + }, + { + "Throws an error if git service is unsupported", + &Branch{ + Name: "feature/divide-operation", + }, + func(cmd string, args ...string) *exec.Cmd { + return exec.Command("echo", "git@something.com:peter/calculator.git") + }, + func(err error) { + assert.Error(t, err) + }, + }, + } + + for _, s := range scenarios { + t.Run(s.testName, func(t *testing.T) { + gitCommand := newDummyGitCommand() + gitCommand.OSCommand.command = s.command + gitCommand.OSCommand.Config.GetUserConfig().Set("os.openCommand", "open {{filename}}") + dummyPullRequest, _ := NewPullRequest(gitCommand) + s.test(dummyPullRequest.Create(s.branch)) + }) + } +} diff --git a/pkg/gui/branches_panel.go b/pkg/gui/branches_panel.go index 0f66533b1..b4ba151b5 100644 --- a/pkg/gui/branches_panel.go +++ b/pkg/gui/branches_panel.go @@ -22,6 +22,17 @@ func (gui *Gui) handleBranchPress(g *gocui.Gui, v *gocui.View) error { return gui.refreshSidePanels(g) } +func (gui *Gui) handleCreatePullRequestPress(g *gocui.Gui, v *gocui.View) error { + branch := gui.getSelectedBranch(gui.getBranchesView(g)) + pullRequest, _ := commands.NewPullRequest(gui.GitCommand) + + if err := pullRequest.Create(branch); err != nil { + return gui.createErrorPanel(g, err.Error()) + } + + return nil +} + func (gui *Gui) handleForceCheckout(g *gocui.Gui, v *gocui.View) error { branch := gui.getSelectedBranch(v) message := gui.Tr.SLocalize("SureForceCheckout") diff --git a/pkg/gui/keybindings.go b/pkg/gui/keybindings.go index 78271a3f7..cc1edc24b 100644 --- a/pkg/gui/keybindings.go +++ b/pkg/gui/keybindings.go @@ -277,6 +277,12 @@ func (gui *Gui) GetKeybindings() []*Binding { Handler: gui.handleBranchPress, KeyReadable: "space", Description: gui.Tr.SLocalize("checkout"), + }, { + ViewName: "branches", + Key: 'o', + Modifier: gocui.ModNone, + Handler: gui.handleCreatePullRequestPress, + Description: gui.Tr.SLocalize("createPullRequest"), }, { ViewName: "branches", Key: 'c', diff --git a/pkg/i18n/dutch.go b/pkg/i18n/dutch.go index 6b24a5174..c95b3a99c 100644 --- a/pkg/i18n/dutch.go +++ b/pkg/i18n/dutch.go @@ -379,6 +379,12 @@ func addDutch(i18nObject *i18n.Bundle) error { }, &i18n.Message{ ID: "ConfirmQuit", Other: `Weet je zeker dat je dit programma wil sluiten?`, + }, &i18n.Message{ + ID: "UnsupportedGitService", + Other: `Niet-ondersteunde git-service`, + }, &i18n.Message{ + ID: "createPullRequest", + Other: `maak een pull-aanvraag`, }, ) } diff --git a/pkg/i18n/english.go b/pkg/i18n/english.go index 9ead5a54e..a549c3d58 100644 --- a/pkg/i18n/english.go +++ b/pkg/i18n/english.go @@ -402,6 +402,12 @@ func addEnglish(i18nObject *i18n.Bundle) error { }, &i18n.Message{ ID: "SwitchRepo", Other: `switch to a recent repo`, + }, &i18n.Message{ + ID: "UnsupportedGitService", + Other: `Unsupported git service`, + }, &i18n.Message{ + ID: "createPullRequest", + Other: `create pull request`, }, ) } diff --git a/pkg/i18n/polish.go b/pkg/i18n/polish.go index c37bfe972..e7003ca36 100644 --- a/pkg/i18n/polish.go +++ b/pkg/i18n/polish.go @@ -377,6 +377,12 @@ func addPolish(i18nObject *i18n.Bundle) error { }, &i18n.Message{ ID: "ConfirmQuit", Other: `Na pewno chcesz wyjść z programu?`, + }, &i18n.Message{ + ID: "UnsupportedGitService", + Other: `Nieobsługiwana usługa git`, + }, &i18n.Message{ + ID: "createPullRequest", + Other: `utwórz żądanie wyciągnięcia`, }, ) } From c69fce2e9d28dc847ad5a4528b99682fe61762af Mon Sep 17 00:00:00 2001 From: Kristijan Husak Date: Mon, 15 Oct 2018 11:00:19 +0200 Subject: [PATCH 3/6] Remove unnecessary nil error in NewPullRequest. --- pkg/commands/pull_request.go | 4 ++-- pkg/commands/pull_request_test.go | 5 +++-- pkg/gui/branches_panel.go | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/pkg/commands/pull_request.go b/pkg/commands/pull_request.go index 4eb030042..bd076d877 100644 --- a/pkg/commands/pull_request.go +++ b/pkg/commands/pull_request.go @@ -44,11 +44,11 @@ func getServices() []*Service { } // NewPullRequest creates new instance of PullRequest -func NewPullRequest(gitCommand *GitCommand) (*PullRequest, error) { +func NewPullRequest(gitCommand *GitCommand) *PullRequest { return &PullRequest{ GitServices: getServices(), GitCommand: gitCommand, - }, nil + } } // Create opens link to new pull request in browser diff --git a/pkg/commands/pull_request_test.go b/pkg/commands/pull_request_test.go index 8173edc71..111845e6d 100644 --- a/pkg/commands/pull_request_test.go +++ b/pkg/commands/pull_request_test.go @@ -1,10 +1,11 @@ package commands import ( - "github.com/stretchr/testify/assert" "os/exec" "strings" "testing" + + "github.com/stretchr/testify/assert" ) func TestGetRepoInfoFromURL(t *testing.T) { @@ -144,7 +145,7 @@ func TestCreatePullRequest(t *testing.T) { gitCommand := newDummyGitCommand() gitCommand.OSCommand.command = s.command gitCommand.OSCommand.Config.GetUserConfig().Set("os.openCommand", "open {{filename}}") - dummyPullRequest, _ := NewPullRequest(gitCommand) + dummyPullRequest := NewPullRequest(gitCommand) s.test(dummyPullRequest.Create(s.branch)) }) } diff --git a/pkg/gui/branches_panel.go b/pkg/gui/branches_panel.go index b4ba151b5..11a4a0ebb 100644 --- a/pkg/gui/branches_panel.go +++ b/pkg/gui/branches_panel.go @@ -24,7 +24,7 @@ func (gui *Gui) handleBranchPress(g *gocui.Gui, v *gocui.View) error { func (gui *Gui) handleCreatePullRequestPress(g *gocui.Gui, v *gocui.View) error { branch := gui.getSelectedBranch(gui.getBranchesView(g)) - pullRequest, _ := commands.NewPullRequest(gui.GitCommand) + pullRequest := commands.NewPullRequest(gui.GitCommand) if err := pullRequest.Create(branch); err != nil { return gui.createErrorPanel(g, err.Error()) From 990dc8c4ea1133a58d5c863abd543ee5cde1e700 Mon Sep 17 00:00:00 2001 From: Kristijan Husak Date: Wed, 17 Oct 2018 14:20:15 +0200 Subject: [PATCH 4/6] Add separate open command for links and check if branch exists on remote before opening pull request link. --- pkg/commands/git.go | 10 ++++++++++ pkg/commands/os.go | 15 +++++++++++++-- pkg/commands/os_default_platform.go | 1 + pkg/commands/pull_request.go | 14 +++++++++----- pkg/commands/pull_request_test.go | 2 +- pkg/config/config_default_platform.go | 3 ++- pkg/config/config_linux.go | 3 ++- pkg/config/config_windows.go | 3 ++- pkg/i18n/dutch.go | 3 +++ pkg/i18n/english.go | 3 +++ pkg/i18n/polish.go | 3 +++ 11 files changed, 49 insertions(+), 11 deletions(-) diff --git a/pkg/commands/git.go b/pkg/commands/git.go index 9764d75d7..bb4f28b75 100644 --- a/pkg/commands/git.go +++ b/pkg/commands/git.go @@ -561,6 +561,16 @@ func (c *GitCommand) GetRemoteURL() string { return utils.TrimTrailingNewline(url) } +// CheckRemoteBranchExists Returns remote branch +func (c *GitCommand) CheckRemoteBranchExists(branch *Branch) bool { + _, err := c.OSCommand.RunCommandWithOutput(fmt.Sprintf( + "git show-ref --verify -- refs/remotes/origin/%s", + branch.Name, + )) + + return err == nil +} + // Diff returns the diff of a file func (c *GitCommand) Diff(file *File) string { cachedArg := "" diff --git a/pkg/commands/os.go b/pkg/commands/os.go index c8ca40f29..2caedf07d 100644 --- a/pkg/commands/os.go +++ b/pkg/commands/os.go @@ -8,9 +8,7 @@ import ( "github.com/jesseduffield/lazygit/pkg/config" "github.com/jesseduffield/lazygit/pkg/utils" - "github.com/mgutz/str" - "github.com/sirupsen/logrus" gitconfig "github.com/tcnksm/go-gitconfig" ) @@ -22,6 +20,7 @@ type Platform struct { shellArg string escapedQuote string openCommand string + openLinkCommand string fallbackEscapedQuote string } @@ -110,6 +109,18 @@ func (c *OSCommand) OpenFile(filename string) error { return err } +// OpenFile opens a file with the given +func (c *OSCommand) OpenLink(link string) error { + commandTemplate := c.Config.GetUserConfig().GetString("os.openLinkCommand") + templateValues := map[string]string{ + "link": c.Quote(link), + } + + command := utils.ResolvePlaceholderString(commandTemplate, templateValues) + err := c.RunCommand(command) + return err +} + // EditFile opens a file in a subprocess using whatever editor is available, // falling back to core.editor, VISUAL, EDITOR, then vi func (c *OSCommand) EditFile(filename string) (*exec.Cmd, error) { diff --git a/pkg/commands/os_default_platform.go b/pkg/commands/os_default_platform.go index 7b063417b..73e453b6b 100644 --- a/pkg/commands/os_default_platform.go +++ b/pkg/commands/os_default_platform.go @@ -13,6 +13,7 @@ func getPlatform() *Platform { shellArg: "-c", escapedQuote: "'", openCommand: "open {{filename}}", + openLinkCommand: "open {{link}}", fallbackEscapedQuote: "\"", } } diff --git a/pkg/commands/pull_request.go b/pkg/commands/pull_request.go index bd076d877..043a3c07d 100644 --- a/pkg/commands/pull_request.go +++ b/pkg/commands/pull_request.go @@ -3,7 +3,6 @@ package commands import ( "errors" "fmt" - "regexp" "strings" ) @@ -53,6 +52,12 @@ func NewPullRequest(gitCommand *GitCommand) *PullRequest { // Create opens link to new pull request in browser func (pr *PullRequest) Create(branch *Branch) error { + branchExistsOnRemote := pr.GitCommand.CheckRemoteBranchExists(branch) + + if !branchExistsOnRemote { + return errors.New(pr.GitCommand.Tr.SLocalize("NoBranchOnRemote")) + } + repoURL := pr.GitCommand.GetRemoteURL() var gitService *Service @@ -69,19 +74,18 @@ func (pr *PullRequest) Create(branch *Branch) error { repoInfo := getRepoInfoFromURL(repoURL) - return pr.GitCommand.OSCommand.OpenFile(fmt.Sprintf( + return pr.GitCommand.OSCommand.OpenLink(fmt.Sprintf( gitService.PullRequestURL, repoInfo.Owner, repoInfo.Repository, branch.Name, )) } func getRepoInfoFromURL(url string) *RepoInformation { isHTTP := strings.HasPrefix(url, "http") - removeGitExtension := regexp.MustCompile(`\.git$`) if isHTTP { splits := strings.Split(url, "/") owner := splits[len(splits)-2] - repo := removeGitExtension.ReplaceAllString(splits[len(splits)-1], "") + repo := strings.TrimSuffix(splits[len(splits)-1], ".git") return &RepoInformation{ Owner: owner, @@ -92,7 +96,7 @@ func getRepoInfoFromURL(url string) *RepoInformation { tmpSplit := strings.Split(url, ":") splits := strings.Split(tmpSplit[1], "/") owner := splits[0] - repo := removeGitExtension.ReplaceAllString(splits[1], "") + repo := strings.TrimSuffix(splits[1], ".git") return &RepoInformation{ Owner: owner, diff --git a/pkg/commands/pull_request_test.go b/pkg/commands/pull_request_test.go index 111845e6d..a551ee081 100644 --- a/pkg/commands/pull_request_test.go +++ b/pkg/commands/pull_request_test.go @@ -144,7 +144,7 @@ func TestCreatePullRequest(t *testing.T) { t.Run(s.testName, func(t *testing.T) { gitCommand := newDummyGitCommand() gitCommand.OSCommand.command = s.command - gitCommand.OSCommand.Config.GetUserConfig().Set("os.openCommand", "open {{filename}}") + gitCommand.OSCommand.Config.GetUserConfig().Set("os.openLinkCommand", "open {{link}}") dummyPullRequest := NewPullRequest(gitCommand) s.test(dummyPullRequest.Create(s.branch)) }) diff --git a/pkg/config/config_default_platform.go b/pkg/config/config_default_platform.go index f3c1a36e5..df205c0d7 100644 --- a/pkg/config/config_default_platform.go +++ b/pkg/config/config_default_platform.go @@ -6,5 +6,6 @@ package config func GetPlatformDefaultConfig() []byte { return []byte( `os: - openCommand: 'open {{filename}}'`) + openCommand: 'open {{filename}}' + openLinkCommand: 'open {{link}}'`) } diff --git a/pkg/config/config_linux.go b/pkg/config/config_linux.go index 90e922416..2dfbdb1c6 100644 --- a/pkg/config/config_linux.go +++ b/pkg/config/config_linux.go @@ -4,5 +4,6 @@ package config func GetPlatformDefaultConfig() []byte { return []byte( `os: - openCommand: 'sh -c "xdg-open {{filename}} >/dev/null"'`) + openCommand: 'sh -c "xdg-open {{filename}} >/dev/null"' + openLinkCommand: 'sh -c "xdg-open {{link}} >/dev/null"'`) } diff --git a/pkg/config/config_windows.go b/pkg/config/config_windows.go index b81a5fdb5..6f6560316 100644 --- a/pkg/config/config_windows.go +++ b/pkg/config/config_windows.go @@ -4,5 +4,6 @@ package config func GetPlatformDefaultConfig() []byte { return []byte( `os: - openCommand: 'cmd /c "start "" {{filename}}"'`) + openCommand: 'cmd /c "start "" {{filename}}"' + openLinkCommand: 'cmd /c "start "" {{link}}"'`) } diff --git a/pkg/i18n/dutch.go b/pkg/i18n/dutch.go index c95b3a99c..74b230ab4 100644 --- a/pkg/i18n/dutch.go +++ b/pkg/i18n/dutch.go @@ -385,6 +385,9 @@ func addDutch(i18nObject *i18n.Bundle) error { }, &i18n.Message{ ID: "createPullRequest", Other: `maak een pull-aanvraag`, + }, &i18n.Message{ + ID: "NoBranchOnRemote", + Other: `Deze tak bestaat niet op de afstandsbediening. U moet eerst op de afstandsbediening drukken.`, }, ) } diff --git a/pkg/i18n/english.go b/pkg/i18n/english.go index a549c3d58..96c2031bf 100644 --- a/pkg/i18n/english.go +++ b/pkg/i18n/english.go @@ -408,6 +408,9 @@ func addEnglish(i18nObject *i18n.Bundle) error { }, &i18n.Message{ ID: "createPullRequest", Other: `create pull request`, + }, &i18n.Message{ + ID: "NoBranchOnRemote", + Other: `This branch doesn't exist on remote. You need to push it to remote first.`, }, ) } diff --git a/pkg/i18n/polish.go b/pkg/i18n/polish.go index e7003ca36..975035771 100644 --- a/pkg/i18n/polish.go +++ b/pkg/i18n/polish.go @@ -383,6 +383,9 @@ func addPolish(i18nObject *i18n.Bundle) error { }, &i18n.Message{ ID: "createPullRequest", Other: `utwórz żądanie wyciągnięcia`, + }, &i18n.Message{ + ID: "NoBranchOnRemote", + Other: `Ta gałąź nie istnieje na zdalnym. Najpierw musisz go odepchnąć na odległość.`, }, ) } From 3a23cb87b70ebb3c7c82be77a264a0b3499d76c0 Mon Sep 17 00:00:00 2001 From: Naveen Vardhi Date: Sun, 21 Oct 2018 21:10:06 +0530 Subject: [PATCH 5/6] Remove force delete keybinding And force delete messages gives feedback about merge status --- pkg/gui/keybindings.go | 6 ------ pkg/i18n/english.go | 2 +- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/pkg/gui/keybindings.go b/pkg/gui/keybindings.go index 78271a3f7..4eea64303 100644 --- a/pkg/gui/keybindings.go +++ b/pkg/gui/keybindings.go @@ -301,12 +301,6 @@ func (gui *Gui) GetKeybindings() []*Binding { Modifier: gocui.ModNone, Handler: gui.handleDeleteBranch, Description: gui.Tr.SLocalize("deleteBranch"), - }, { - ViewName: "branches", - Key: 'D', - Modifier: gocui.ModNone, - Handler: gui.handleForceDeleteBranch, - Description: gui.Tr.SLocalize("forceDeleteBranch"), }, { ViewName: "branches", Key: 'm', diff --git a/pkg/i18n/english.go b/pkg/i18n/english.go index 9ead5a54e..559dbb70c 100644 --- a/pkg/i18n/english.go +++ b/pkg/i18n/english.go @@ -176,7 +176,7 @@ func addEnglish(i18nObject *i18n.Bundle) error { Other: "Are you sure you want to delete the branch {{.selectedBranchName}}?", }, &i18n.Message{ ID: "ForceDeleteBranchMessage", - Other: "Are you sure you want to force delete the branch {{.selectedBranchName}}?", + Other: "{{.selectedBranchName}} is not fully merged. Are you sure you want to delete it?", }, &i18n.Message{ ID: "CantMergeBranchIntoItself", Other: "You cannot merge a branch into itself", From bfcb3489238eb90588daea0148d49361c74e43e8 Mon Sep 17 00:00:00 2001 From: Daniel Bast <2790401+dbast@users.noreply.github.com> Date: Thu, 25 Oct 2018 09:54:01 +0200 Subject: [PATCH 6/6] Add conda to readme as possibility to install on different platforms --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index e20de5900..d7ff1ea1b 100644 --- a/README.md +++ b/README.md @@ -69,6 +69,12 @@ and the git version which builds from the most recent commit. Instruction of how to install AUR content can be found here: https://wiki.archlinux.org/index.php/Arch_User_Repository +### Conda +Released versions are available for different platforms, see https://anaconda.org/conda-forge/lazygit +```sh +conda install -c conda-forge lazygit +``` + ### Binary Release (Windows/Linux/OSX) You can download a binary release [here](https://github.com/jesseduffield/lazygit/releases).