summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYuki Osaki <yuki.osaki7@gmail.com>2020-11-27 16:07:14 +0900
committerJesse Duffield <jessedduffield@gmail.com>2020-11-28 19:19:47 +1100
commit4928d1d490becaac9464ac1d6217ab60382791cc (patch)
tree4a14a398b633d046bd8e5570efab638093078e3b
parent9c52eb9d6f2d2eadd30852bba49b148e785b06d3 (diff)
Visualize the commits for all branches
-rw-r--r--docs/Config.md1
-rw-r--r--pkg/commands/git_test.go12
-rw-r--r--pkg/config/user_config.go13
-rw-r--r--pkg/gui/keybindings.go6
-rw-r--r--pkg/gui/recent_repos_panel.go14
-rw-r--r--pkg/i18n/dutch.go1
-rw-r--r--pkg/i18n/english.go2
-rw-r--r--pkg/i18n/polish.go1
8 files changed, 45 insertions, 5 deletions
diff --git a/docs/Config.md b/docs/Config.md
index c3aa2417e..3d3d5cfb1 100644
--- a/docs/Config.md
+++ b/docs/Config.md
@@ -48,6 +48,7 @@ Default path for the config file:
skipHookPrefix: WIP
autoFetch: true
branchLogCmd: "git log --graph --color=always --abbrev-commit --decorate --date=relative --pretty=medium {{branchName}} --"
+ allBranchesLogCmd: "git log --graph --all --color=always --abbrev-commit --decorate --date=relative --pretty=medium"
overrideGpg: false # prevents lazygit from spawning a separate process when using GPG
disableForcePushing: false
update:
diff --git a/pkg/commands/git_test.go b/pkg/commands/git_test.go
index 75bb5b8a6..ac34d195c 100644
--- a/pkg/commands/git_test.go
+++ b/pkg/commands/git_test.go
@@ -1443,6 +1443,18 @@ func TestGitCommandGetBranchGraph(t *testing.T) {
assert.NoError(t, err)
}
+func TestGitCommandGetAllBranchGraph(t *testing.T) {
+ gitCmd := NewDummyGitCommand()
+ gitCmd.OSCommand.Command = func(cmd string, args ...string) *exec.Cmd {
+ assert.EqualValues(t, "git", cmd)
+ assert.EqualValues(t, []string{"log", "--graph", "--all", "--color=always", "--abbrev-commit", "--decorate", "--date=relative", "--pretty=medium"}, args)
+ return exec.Command("echo")
+ }
+ cmdStr := gitCmd.Config.GetUserConfig().Git.AllBranchesLogCmd
+ _, err := gitCmd.OSCommand.RunCommandWithOutput(cmdStr)
+ assert.NoError(t, err)
+}
+
// TestGitCommandDiff is a function.
func TestGitCommandDiff(t *testing.T) {
type scenario struct {
diff --git a/pkg/config/user_config.go b/pkg/config/user_config.go
index 6fc28f101..ffdd93a8d 100644
--- a/pkg/config/user_config.go
+++ b/pkg/config/user_config.go
@@ -51,6 +51,7 @@ type GitConfig struct {
SkipHookPrefix string `yaml:"skipHookPrefix"`
AutoFetch bool `yaml:"autoFetch"`
BranchLogCmd string `yaml:"branchLogCmd"`
+ AllBranchesLogCmd string `yaml:"allBranchesLogCmd"`
OverrideGpg bool `yaml:"overrideGpg"`
DisableForcePushing bool `yaml:"disableForcePushing"`
CommitPrefixes map[string]CommitPrefixConfig `yaml:"commitPrefixes"`
@@ -151,8 +152,9 @@ type KeybindingUniversalConfig struct {
}
type KeybindingStatusConfig struct {
- CheckForUpdate string `yaml:"checkForUpdate"`
- RecentRepos string `yaml:"recentRepos"`
+ CheckForUpdate string `yaml:"checkForUpdate"`
+ RecentRepos string `yaml:"recentRepos"`
+ AllBranchesLogGraph string `yaml:"allBranchesLogGraph"`
}
type KeybindingFilesConfig struct {
@@ -300,7 +302,7 @@ func GetDefaultConfig() *UserConfig {
SkipHookPrefix: "WIP",
AutoFetch: true,
BranchLogCmd: "git log --graph --color=always --abbrev-commit --decorate --date=relative --pretty=medium {{branchName}} --",
- OverrideGpg: false,
+ AllBranchesLogCmd: "git log --graph --all --color=always --abbrev-commit --decorate --date=relative --pretty=medium",
DisableForcePushing: false,
CommitPrefixes: map[string]CommitPrefixConfig(nil),
},
@@ -370,8 +372,9 @@ func GetDefaultConfig() *UserConfig {
AppendNewline: "<tab>",
},
Status: KeybindingStatusConfig{
- CheckForUpdate: "u",
- RecentRepos: "<enter>",
+ CheckForUpdate: "u",
+ RecentRepos: "<enter>",
+ AllBranchesLogGraph: "a",
},
Files: KeybindingFilesConfig{
CommitChanges: "c",
diff --git a/pkg/gui/keybindings.go b/pkg/gui/keybindings.go
index db01c1455..bfbacea63 100644
--- a/pkg/gui/keybindings.go
+++ b/pkg/gui/keybindings.go
@@ -360,6 +360,12 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
Description: gui.Tr.SwitchRepo,
},
{
+ ViewName: "status",
+ Key: gui.getKey(config.Status.AllBranchesLogGraph),
+ Handler: gui.wrappedHandler(gui.handleShowAllBranchLogs),
+ Description: gui.Tr.AllBranchesLogGraph,
+ },
+ {
ViewName: "files",
Contexts: []string{FILES_CONTEXT_KEY},
Key: gui.getKey(config.Files.CommitChanges),
diff --git a/pkg/gui/recent_repos_panel.go b/pkg/gui/recent_repos_panel.go
index 7b15dd41a..6fe038111 100644
--- a/pkg/gui/recent_repos_panel.go
+++ b/pkg/gui/recent_repos_panel.go
@@ -32,6 +32,20 @@ func (gui *Gui) handleCreateRecentReposMenu() error {
return gui.createMenu(gui.Tr.RecentRepos, menuItems, createMenuOptions{showCancel: true})
}
+func (gui *Gui) handleShowAllBranchLogs() error {
+ cmd := gui.OSCommand.ExecutableFromString(
+ gui.Config.GetUserConfig().Git.AllBranchesLogCmd,
+ )
+ task := gui.createRunPtyTask(cmd)
+
+ return gui.refreshMainViews(refreshMainOpts{
+ main: &viewUpdateOpts{
+ title: "Log",
+ task: task,
+ },
+ })
+}
+
func (gui *Gui) dispatchSwitchToRepo(path string) error {
env.UnsetGitDirEnvs()
if err := os.Chdir(path); err != nil {
diff --git a/pkg/i18n/dutch.go b/pkg/i18n/dutch.go
index 9b50ec79e..332fe5cc3 100644
--- a/pkg/i18n/dutch.go
+++ b/pkg/i18n/dutch.go
@@ -152,6 +152,7 @@ func dutchTranslationSet() TranslationSet {
LcMergeIntoCurrentBranch: `merge in met huidige checked out branch`,
ConfirmQuit: `Weet je zeker dat je dit programma wil sluiten?`,
SwitchRepo: "wissel naar een recente repo",
+ AllBranchesLogGraph: `alle takken van het houtblok laten zien`,
UnsupportedGitService: `Niet-ondersteunde git-service`,
LcCreatePullRequest: `maak een pull-aanvraag`,
LcCopyPullRequestURL: `kopieer de URL van het pull-verzoek naar het klembord`,
diff --git a/pkg/i18n/english.go b/pkg/i18n/english.go
index 81a648928..93ccc75a6 100644
--- a/pkg/i18n/english.go
+++ b/pkg/i18n/english.go
@@ -164,6 +164,7 @@ type TranslationSet struct {
LcMergeIntoCurrentBranch string
ConfirmQuit string
SwitchRepo string
+ AllBranchesLogGraph string
UnsupportedGitService string
LcCreatePullRequest string
LcCopyPullRequestURL string
@@ -666,6 +667,7 @@ func englishTranslationSet() TranslationSet {
LcMergeIntoCurrentBranch: `merge into currently checked out branch`,
ConfirmQuit: `Are you sure you want to quit?`,
SwitchRepo: `switch to a recent repo`,
+ AllBranchesLogGraph: `show all branch logs`,
UnsupportedGitService: `Unsupported git service`,
LcCreatePullRequest: `create pull request`,
LcCopyPullRequestURL: `copy pull request URL to clipboard`,
diff --git a/pkg/i18n/polish.go b/pkg/i18n/polish.go
index c6ffba11a..9b9e64d20 100644
--- a/pkg/i18n/polish.go
+++ b/pkg/i18n/polish.go
@@ -125,6 +125,7 @@ func polishTranslationSet() TranslationSet {
LcRefreshFiles: `odśwież pliki`,
LcMergeIntoCurrentBranch: `scal do obecnej gałęzi`,
ConfirmQuit: `Na pewno chcesz wyjść z programu?`,
+ AllBranchesLogGraph: `pokazywać wszystkie logi branżowe`,
UnsupportedGitService: `Nieobsługiwana usługa git`,
LcCreatePullRequest: `utwórz żądanie wyciągnięcia`,
LcCopyPullRequestURL: `skopiuj adres URL żądania ściągnięcia do schowka`,