mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-05-13 05:15:53 +02:00
Visualize the commits for all branches
This commit is contained in:
parent
9c52eb9d6f
commit
4928d1d490
8 changed files with 45 additions and 5 deletions
|
@ -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:
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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"`
|
||||
|
@ -153,6 +154,7 @@ type KeybindingUniversalConfig struct {
|
|||
type KeybindingStatusConfig struct {
|
||||
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),
|
||||
},
|
||||
|
@ -372,6 +374,7 @@ func GetDefaultConfig() *UserConfig {
|
|||
Status: KeybindingStatusConfig{
|
||||
CheckForUpdate: "u",
|
||||
RecentRepos: "<enter>",
|
||||
AllBranchesLogGraph: "a",
|
||||
},
|
||||
Files: KeybindingFilesConfig{
|
||||
CommitChanges: "c",
|
||||
|
|
|
@ -359,6 +359,12 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
|
|||
Handler: gui.wrappedHandler(gui.handleCreateRecentReposMenu),
|
||||
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},
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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`,
|
||||
|
|
|
@ -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`,
|
||||
|
|
|
@ -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`,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue