mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-11-29 22:48:24 +02:00
Add command "View divergence from base branch"
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
package branch
|
||||
|
||||
import (
|
||||
"github.com/jesseduffield/lazygit/pkg/config"
|
||||
. "github.com/jesseduffield/lazygit/pkg/integration/components"
|
||||
)
|
||||
|
||||
var ShowDivergenceFromBaseBranch = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Description: "Show divergence from base branch",
|
||||
ExtraCmdArgs: []string{},
|
||||
Skip: false,
|
||||
SetupConfig: func(config *config.AppConfig) {
|
||||
config.UserConfig.Gui.ShowDivergenceFromBaseBranch = "arrowAndNumber"
|
||||
},
|
||||
SetupRepo: func(shell *Shell) {
|
||||
shell.
|
||||
EmptyCommit("master 1").
|
||||
EmptyCommit("master 2").
|
||||
EmptyCommit("master 3").
|
||||
NewBranchFrom("feature", "master^").
|
||||
EmptyCommit("feature 1").
|
||||
EmptyCommit("feature 2")
|
||||
},
|
||||
Run: func(t *TestDriver, keys config.KeybindingConfig) {
|
||||
t.Views().Branches().
|
||||
Focus().
|
||||
Lines(
|
||||
Contains("feature ↓1").IsSelected(),
|
||||
Contains("master"),
|
||||
).
|
||||
Press(keys.Branches.SetUpstream)
|
||||
|
||||
t.ExpectPopup().Menu().Title(Contains("Upstream")).
|
||||
Select(Contains("View divergence from base branch (master)")).Confirm()
|
||||
|
||||
t.Views().SubCommits().
|
||||
IsFocused().
|
||||
Title(Contains("Commits (feature <-> master)")).
|
||||
Lines(
|
||||
DoesNotContainAnyOf("↓", "↑").Contains("--- Remote ---"),
|
||||
Contains("↓").Contains("master 3"),
|
||||
DoesNotContainAnyOf("↓", "↑").Contains("--- Local ---"),
|
||||
Contains("↑").Contains("feature 2"),
|
||||
Contains("↑").Contains("feature 1"),
|
||||
)
|
||||
},
|
||||
})
|
||||
@@ -56,6 +56,7 @@ var tests = []*components.IntegrationTest{
|
||||
branch.Reset,
|
||||
branch.ResetToUpstream,
|
||||
branch.SetUpstream,
|
||||
branch.ShowDivergenceFromBaseBranch,
|
||||
branch.ShowDivergenceFromUpstream,
|
||||
branch.SortLocalBranches,
|
||||
branch.SortRemoteBranches,
|
||||
|
||||
Reference in New Issue
Block a user