mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-06-15 00:15:32 +02:00
Visualize the commits for all branches
This commit is contained in:
committed by
Jesse Duffield
parent
9c52eb9d6f
commit
4928d1d490
@ -48,6 +48,7 @@ Default path for the config file:
|
|||||||
skipHookPrefix: WIP
|
skipHookPrefix: WIP
|
||||||
autoFetch: true
|
autoFetch: true
|
||||||
branchLogCmd: "git log --graph --color=always --abbrev-commit --decorate --date=relative --pretty=medium {{branchName}} --"
|
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
|
overrideGpg: false # prevents lazygit from spawning a separate process when using GPG
|
||||||
disableForcePushing: false
|
disableForcePushing: false
|
||||||
update:
|
update:
|
||||||
|
@ -1443,6 +1443,18 @@ func TestGitCommandGetBranchGraph(t *testing.T) {
|
|||||||
assert.NoError(t, err)
|
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.
|
// TestGitCommandDiff is a function.
|
||||||
func TestGitCommandDiff(t *testing.T) {
|
func TestGitCommandDiff(t *testing.T) {
|
||||||
type scenario struct {
|
type scenario struct {
|
||||||
|
@ -51,6 +51,7 @@ type GitConfig struct {
|
|||||||
SkipHookPrefix string `yaml:"skipHookPrefix"`
|
SkipHookPrefix string `yaml:"skipHookPrefix"`
|
||||||
AutoFetch bool `yaml:"autoFetch"`
|
AutoFetch bool `yaml:"autoFetch"`
|
||||||
BranchLogCmd string `yaml:"branchLogCmd"`
|
BranchLogCmd string `yaml:"branchLogCmd"`
|
||||||
|
AllBranchesLogCmd string `yaml:"allBranchesLogCmd"`
|
||||||
OverrideGpg bool `yaml:"overrideGpg"`
|
OverrideGpg bool `yaml:"overrideGpg"`
|
||||||
DisableForcePushing bool `yaml:"disableForcePushing"`
|
DisableForcePushing bool `yaml:"disableForcePushing"`
|
||||||
CommitPrefixes map[string]CommitPrefixConfig `yaml:"commitPrefixes"`
|
CommitPrefixes map[string]CommitPrefixConfig `yaml:"commitPrefixes"`
|
||||||
@ -153,6 +154,7 @@ type KeybindingUniversalConfig struct {
|
|||||||
type KeybindingStatusConfig struct {
|
type KeybindingStatusConfig struct {
|
||||||
CheckForUpdate string `yaml:"checkForUpdate"`
|
CheckForUpdate string `yaml:"checkForUpdate"`
|
||||||
RecentRepos string `yaml:"recentRepos"`
|
RecentRepos string `yaml:"recentRepos"`
|
||||||
|
AllBranchesLogGraph string `yaml:"allBranchesLogGraph"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type KeybindingFilesConfig struct {
|
type KeybindingFilesConfig struct {
|
||||||
@ -300,7 +302,7 @@ func GetDefaultConfig() *UserConfig {
|
|||||||
SkipHookPrefix: "WIP",
|
SkipHookPrefix: "WIP",
|
||||||
AutoFetch: true,
|
AutoFetch: true,
|
||||||
BranchLogCmd: "git log --graph --color=always --abbrev-commit --decorate --date=relative --pretty=medium {{branchName}} --",
|
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,
|
DisableForcePushing: false,
|
||||||
CommitPrefixes: map[string]CommitPrefixConfig(nil),
|
CommitPrefixes: map[string]CommitPrefixConfig(nil),
|
||||||
},
|
},
|
||||||
@ -372,6 +374,7 @@ func GetDefaultConfig() *UserConfig {
|
|||||||
Status: KeybindingStatusConfig{
|
Status: KeybindingStatusConfig{
|
||||||
CheckForUpdate: "u",
|
CheckForUpdate: "u",
|
||||||
RecentRepos: "<enter>",
|
RecentRepos: "<enter>",
|
||||||
|
AllBranchesLogGraph: "a",
|
||||||
},
|
},
|
||||||
Files: KeybindingFilesConfig{
|
Files: KeybindingFilesConfig{
|
||||||
CommitChanges: "c",
|
CommitChanges: "c",
|
||||||
|
@ -359,6 +359,12 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
|
|||||||
Handler: gui.wrappedHandler(gui.handleCreateRecentReposMenu),
|
Handler: gui.wrappedHandler(gui.handleCreateRecentReposMenu),
|
||||||
Description: gui.Tr.SwitchRepo,
|
Description: gui.Tr.SwitchRepo,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
ViewName: "status",
|
||||||
|
Key: gui.getKey(config.Status.AllBranchesLogGraph),
|
||||||
|
Handler: gui.wrappedHandler(gui.handleShowAllBranchLogs),
|
||||||
|
Description: gui.Tr.AllBranchesLogGraph,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
ViewName: "files",
|
ViewName: "files",
|
||||||
Contexts: []string{FILES_CONTEXT_KEY},
|
Contexts: []string{FILES_CONTEXT_KEY},
|
||||||
|
@ -32,6 +32,20 @@ func (gui *Gui) handleCreateRecentReposMenu() error {
|
|||||||
return gui.createMenu(gui.Tr.RecentRepos, menuItems, createMenuOptions{showCancel: true})
|
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 {
|
func (gui *Gui) dispatchSwitchToRepo(path string) error {
|
||||||
env.UnsetGitDirEnvs()
|
env.UnsetGitDirEnvs()
|
||||||
if err := os.Chdir(path); err != nil {
|
if err := os.Chdir(path); err != nil {
|
||||||
|
@ -152,6 +152,7 @@ func dutchTranslationSet() TranslationSet {
|
|||||||
LcMergeIntoCurrentBranch: `merge in met huidige checked out branch`,
|
LcMergeIntoCurrentBranch: `merge in met huidige checked out branch`,
|
||||||
ConfirmQuit: `Weet je zeker dat je dit programma wil sluiten?`,
|
ConfirmQuit: `Weet je zeker dat je dit programma wil sluiten?`,
|
||||||
SwitchRepo: "wissel naar een recente repo",
|
SwitchRepo: "wissel naar een recente repo",
|
||||||
|
AllBranchesLogGraph: `alle takken van het houtblok laten zien`,
|
||||||
UnsupportedGitService: `Niet-ondersteunde git-service`,
|
UnsupportedGitService: `Niet-ondersteunde git-service`,
|
||||||
LcCreatePullRequest: `maak een pull-aanvraag`,
|
LcCreatePullRequest: `maak een pull-aanvraag`,
|
||||||
LcCopyPullRequestURL: `kopieer de URL van het pull-verzoek naar het klembord`,
|
LcCopyPullRequestURL: `kopieer de URL van het pull-verzoek naar het klembord`,
|
||||||
|
@ -164,6 +164,7 @@ type TranslationSet struct {
|
|||||||
LcMergeIntoCurrentBranch string
|
LcMergeIntoCurrentBranch string
|
||||||
ConfirmQuit string
|
ConfirmQuit string
|
||||||
SwitchRepo string
|
SwitchRepo string
|
||||||
|
AllBranchesLogGraph string
|
||||||
UnsupportedGitService string
|
UnsupportedGitService string
|
||||||
LcCreatePullRequest string
|
LcCreatePullRequest string
|
||||||
LcCopyPullRequestURL string
|
LcCopyPullRequestURL string
|
||||||
@ -666,6 +667,7 @@ func englishTranslationSet() TranslationSet {
|
|||||||
LcMergeIntoCurrentBranch: `merge into currently checked out branch`,
|
LcMergeIntoCurrentBranch: `merge into currently checked out branch`,
|
||||||
ConfirmQuit: `Are you sure you want to quit?`,
|
ConfirmQuit: `Are you sure you want to quit?`,
|
||||||
SwitchRepo: `switch to a recent repo`,
|
SwitchRepo: `switch to a recent repo`,
|
||||||
|
AllBranchesLogGraph: `show all branch logs`,
|
||||||
UnsupportedGitService: `Unsupported git service`,
|
UnsupportedGitService: `Unsupported git service`,
|
||||||
LcCreatePullRequest: `create pull request`,
|
LcCreatePullRequest: `create pull request`,
|
||||||
LcCopyPullRequestURL: `copy pull request URL to clipboard`,
|
LcCopyPullRequestURL: `copy pull request URL to clipboard`,
|
||||||
|
@ -125,6 +125,7 @@ func polishTranslationSet() TranslationSet {
|
|||||||
LcRefreshFiles: `odśwież pliki`,
|
LcRefreshFiles: `odśwież pliki`,
|
||||||
LcMergeIntoCurrentBranch: `scal do obecnej gałęzi`,
|
LcMergeIntoCurrentBranch: `scal do obecnej gałęzi`,
|
||||||
ConfirmQuit: `Na pewno chcesz wyjść z programu?`,
|
ConfirmQuit: `Na pewno chcesz wyjść z programu?`,
|
||||||
|
AllBranchesLogGraph: `pokazywać wszystkie logi branżowe`,
|
||||||
UnsupportedGitService: `Nieobsługiwana usługa git`,
|
UnsupportedGitService: `Nieobsługiwana usługa git`,
|
||||||
LcCreatePullRequest: `utwórz żądanie wyciągnięcia`,
|
LcCreatePullRequest: `utwórz żądanie wyciągnięcia`,
|
||||||
LcCopyPullRequestURL: `skopiuj adres URL żądania ściągnięcia do schowka`,
|
LcCopyPullRequestURL: `skopiuj adres URL żądania ściągnięcia do schowka`,
|
||||||
|
Reference in New Issue
Block a user