mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-05-12 21:05:48 +02:00
more consistent naming
This commit is contained in:
parent
55af07a1bb
commit
371b8d638b
18 changed files with 48 additions and 48 deletions
|
@ -84,7 +84,7 @@ func (gui *Gui) handleDiscardOldFileChange() error {
|
||||||
HandleConfirm: func() error {
|
HandleConfirm: func() error {
|
||||||
return gui.c.WithWaitingStatus(gui.c.Tr.RebasingStatus, func() error {
|
return gui.c.WithWaitingStatus(gui.c.Tr.RebasingStatus, func() error {
|
||||||
gui.c.LogAction(gui.c.Tr.Actions.DiscardOldFileChange)
|
gui.c.LogAction(gui.c.Tr.Actions.DiscardOldFileChange)
|
||||||
if err := gui.git.Rebase.DiscardOldFileChanges(gui.State.Model.Commits, gui.State.Contexts.BranchCommits.GetSelectedLineIdx(), fileName); err != nil {
|
if err := gui.git.Rebase.DiscardOldFileChanges(gui.State.Model.Commits, gui.State.Contexts.LocalCommits.GetSelectedLineIdx(), fileName); err != nil {
|
||||||
if err := gui.helpers.MergeAndRebase.CheckMergeOrRebase(err); err != nil {
|
if err := gui.helpers.MergeAndRebase.CheckMergeOrRebase(err); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -98,7 +98,7 @@ func (gui *Gui) handleDiscardOldFileChange() error {
|
||||||
|
|
||||||
func (gui *Gui) refreshCommitFilesView() error {
|
func (gui *Gui) refreshCommitFilesView() error {
|
||||||
currentSideContext := gui.currentSideContext()
|
currentSideContext := gui.currentSideContext()
|
||||||
if currentSideContext.GetKey() == context.COMMIT_FILES_CONTEXT_KEY || currentSideContext.GetKey() == context.BRANCH_COMMITS_CONTEXT_KEY {
|
if currentSideContext.GetKey() == context.COMMIT_FILES_CONTEXT_KEY || currentSideContext.GetKey() == context.LOCAL_COMMITS_CONTEXT_KEY {
|
||||||
if err := gui.handleRefreshPatchBuildingPanel(-1); err != nil {
|
if err := gui.handleRefreshPatchBuildingPanel(-1); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,11 +11,11 @@ const COMMIT_THRESHOLD = 200
|
||||||
// list panel functions
|
// list panel functions
|
||||||
|
|
||||||
func (gui *Gui) getSelectedLocalCommit() *models.Commit {
|
func (gui *Gui) getSelectedLocalCommit() *models.Commit {
|
||||||
return gui.State.Contexts.BranchCommits.GetSelected()
|
return gui.State.Contexts.LocalCommits.GetSelected()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (gui *Gui) onCommitFocus() error {
|
func (gui *Gui) onCommitFocus() error {
|
||||||
context := gui.State.Contexts.BranchCommits
|
context := gui.State.Contexts.LocalCommits
|
||||||
if context.GetSelectedLineIdx() > COMMIT_THRESHOLD && context.GetLimitCommits() {
|
if context.GetSelectedLineIdx() > COMMIT_THRESHOLD && context.GetLimitCommits() {
|
||||||
context.SetLimitCommits(false)
|
context.SetLimitCommits(false)
|
||||||
go utils.Safe(func() {
|
go utils.Safe(func() {
|
||||||
|
@ -32,7 +32,7 @@ func (gui *Gui) onCommitFocus() error {
|
||||||
|
|
||||||
func (gui *Gui) branchCommitsRenderToMain() error {
|
func (gui *Gui) branchCommitsRenderToMain() error {
|
||||||
var task updateTask
|
var task updateTask
|
||||||
commit := gui.State.Contexts.BranchCommits.GetSelected()
|
commit := gui.State.Contexts.LocalCommits.GetSelected()
|
||||||
if commit == nil {
|
if commit == nil {
|
||||||
task = NewRenderStringTask(gui.c.Tr.NoCommitsThisBranch)
|
task = NewRenderStringTask(gui.c.Tr.NoCommitsThisBranch)
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -336,7 +336,7 @@ func (gui *Gui) currentStaticContext() types.Context {
|
||||||
|
|
||||||
func (gui *Gui) defaultSideContext() types.Context {
|
func (gui *Gui) defaultSideContext() types.Context {
|
||||||
if gui.State.Modes.Filtering.Active() {
|
if gui.State.Modes.Filtering.Active() {
|
||||||
return gui.State.Contexts.BranchCommits
|
return gui.State.Contexts.LocalCommits
|
||||||
} else {
|
} else {
|
||||||
return gui.State.Contexts.Files
|
return gui.State.Contexts.Files
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ const (
|
||||||
REMOTES_CONTEXT_KEY types.ContextKey = "remotes"
|
REMOTES_CONTEXT_KEY types.ContextKey = "remotes"
|
||||||
REMOTE_BRANCHES_CONTEXT_KEY types.ContextKey = "remoteBranches"
|
REMOTE_BRANCHES_CONTEXT_KEY types.ContextKey = "remoteBranches"
|
||||||
TAGS_CONTEXT_KEY types.ContextKey = "tags"
|
TAGS_CONTEXT_KEY types.ContextKey = "tags"
|
||||||
BRANCH_COMMITS_CONTEXT_KEY types.ContextKey = "commits"
|
LOCAL_COMMITS_CONTEXT_KEY types.ContextKey = "commits"
|
||||||
REFLOG_COMMITS_CONTEXT_KEY types.ContextKey = "reflogCommits"
|
REFLOG_COMMITS_CONTEXT_KEY types.ContextKey = "reflogCommits"
|
||||||
SUB_COMMITS_CONTEXT_KEY types.ContextKey = "subCommits"
|
SUB_COMMITS_CONTEXT_KEY types.ContextKey = "subCommits"
|
||||||
COMMIT_FILES_CONTEXT_KEY types.ContextKey = "commitFiles"
|
COMMIT_FILES_CONTEXT_KEY types.ContextKey = "commitFiles"
|
||||||
|
@ -41,7 +41,7 @@ var AllContextKeys = []types.ContextKey{
|
||||||
REMOTES_CONTEXT_KEY,
|
REMOTES_CONTEXT_KEY,
|
||||||
REMOTE_BRANCHES_CONTEXT_KEY,
|
REMOTE_BRANCHES_CONTEXT_KEY,
|
||||||
TAGS_CONTEXT_KEY,
|
TAGS_CONTEXT_KEY,
|
||||||
BRANCH_COMMITS_CONTEXT_KEY,
|
LOCAL_COMMITS_CONTEXT_KEY,
|
||||||
REFLOG_COMMITS_CONTEXT_KEY,
|
REFLOG_COMMITS_CONTEXT_KEY,
|
||||||
SUB_COMMITS_CONTEXT_KEY,
|
SUB_COMMITS_CONTEXT_KEY,
|
||||||
COMMIT_FILES_CONTEXT_KEY,
|
COMMIT_FILES_CONTEXT_KEY,
|
||||||
|
@ -67,7 +67,7 @@ type ContextTree struct {
|
||||||
Menu *MenuContext
|
Menu *MenuContext
|
||||||
Branches *BranchesContext
|
Branches *BranchesContext
|
||||||
Tags *TagsContext
|
Tags *TagsContext
|
||||||
BranchCommits *LocalCommitsContext
|
LocalCommits *LocalCommitsContext
|
||||||
CommitFiles *CommitFilesContext
|
CommitFiles *CommitFilesContext
|
||||||
Remotes *RemotesContext
|
Remotes *RemotesContext
|
||||||
Submodules *SubmodulesContext
|
Submodules *SubmodulesContext
|
||||||
|
@ -97,7 +97,7 @@ func (self *ContextTree) Flatten() []types.Context {
|
||||||
self.Remotes,
|
self.Remotes,
|
||||||
self.RemoteBranches,
|
self.RemoteBranches,
|
||||||
self.Tags,
|
self.Tags,
|
||||||
self.BranchCommits,
|
self.LocalCommits,
|
||||||
self.CommitFiles,
|
self.CommitFiles,
|
||||||
self.ReflogCommits,
|
self.ReflogCommits,
|
||||||
self.Stash,
|
self.Stash,
|
||||||
|
@ -170,7 +170,7 @@ func (tree ContextTree) InitialViewTabContextMap() map[string][]TabContext {
|
||||||
"commits": {
|
"commits": {
|
||||||
{
|
{
|
||||||
Tab: "Commits",
|
Tab: "Commits",
|
||||||
Contexts: []types.Context{tree.BranchCommits},
|
Contexts: []types.Context{tree.LocalCommits},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Tab: "Reflog",
|
Tab: "Reflog",
|
||||||
|
|
|
@ -34,7 +34,7 @@ func NewLocalCommitsContext(
|
||||||
Context: NewSimpleContext(NewBaseContext(NewBaseContextOpts{
|
Context: NewSimpleContext(NewBaseContext(NewBaseContextOpts{
|
||||||
ViewName: "commits",
|
ViewName: "commits",
|
||||||
WindowName: "commits",
|
WindowName: "commits",
|
||||||
Key: BRANCH_COMMITS_CONTEXT_KEY,
|
Key: LOCAL_COMMITS_CONTEXT_KEY,
|
||||||
Kind: types.SIDE_CONTEXT,
|
Kind: types.SIDE_CONTEXT,
|
||||||
Focusable: true,
|
Focusable: true,
|
||||||
}), ContextCallbackOpts{
|
}), ContextCallbackOpts{
|
||||||
|
|
|
@ -36,7 +36,7 @@ func (gui *Gui) contextTree() *context.ContextTree {
|
||||||
Menu: gui.menuListContext(),
|
Menu: gui.menuListContext(),
|
||||||
Remotes: gui.remotesListContext(),
|
Remotes: gui.remotesListContext(),
|
||||||
RemoteBranches: gui.remoteBranchesListContext(),
|
RemoteBranches: gui.remoteBranchesListContext(),
|
||||||
BranchCommits: gui.branchCommitsListContext(),
|
LocalCommits: gui.branchCommitsListContext(),
|
||||||
CommitFiles: gui.commitFilesListContext(),
|
CommitFiles: gui.commitFilesListContext(),
|
||||||
ReflogCommits: gui.reflogCommitsListContext(),
|
ReflogCommits: gui.reflogCommitsListContext(),
|
||||||
SubCommits: gui.subCommitsListContext(),
|
SubCommits: gui.subCommitsListContext(),
|
||||||
|
|
|
@ -239,5 +239,5 @@ func (self *BisectController) Context() types.Context {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *BisectController) context() *context.LocalCommitsContext {
|
func (self *BisectController) context() *context.LocalCommitsContext {
|
||||||
return self.contexts.BranchCommits
|
return self.contexts.LocalCommits
|
||||||
}
|
}
|
||||||
|
|
|
@ -143,7 +143,7 @@ func (self *CherryPickHelper) resetIfNecessary(context types.Context) error {
|
||||||
|
|
||||||
func (self *CherryPickHelper) rerender() error {
|
func (self *CherryPickHelper) rerender() error {
|
||||||
for _, context := range []types.Context{
|
for _, context := range []types.Context{
|
||||||
self.contexts.BranchCommits,
|
self.contexts.LocalCommits,
|
||||||
self.contexts.ReflogCommits,
|
self.contexts.ReflogCommits,
|
||||||
self.contexts.SubCommits,
|
self.contexts.SubCommits,
|
||||||
} {
|
} {
|
||||||
|
|
|
@ -55,9 +55,9 @@ func (self *RefsHelper) CheckoutRef(ref string, options types.CheckoutRefOptions
|
||||||
onSuccess := func() {
|
onSuccess := func() {
|
||||||
self.contexts.Branches.SetSelectedLineIdx(0)
|
self.contexts.Branches.SetSelectedLineIdx(0)
|
||||||
self.contexts.ReflogCommits.SetSelectedLineIdx(0)
|
self.contexts.ReflogCommits.SetSelectedLineIdx(0)
|
||||||
self.contexts.BranchCommits.SetSelectedLineIdx(0)
|
self.contexts.LocalCommits.SetSelectedLineIdx(0)
|
||||||
// loading a heap of commits is slow so we limit them whenever doing a reset
|
// loading a heap of commits is slow so we limit them whenever doing a reset
|
||||||
self.contexts.BranchCommits.SetLimitCommits(true)
|
self.contexts.LocalCommits.SetLimitCommits(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
return self.c.WithWaitingStatus(waitingStatus, func() error {
|
return self.c.WithWaitingStatus(waitingStatus, func() error {
|
||||||
|
@ -117,12 +117,12 @@ func (self *RefsHelper) ResetToRef(ref string, strength string, envVars []string
|
||||||
return self.c.Error(err)
|
return self.c.Error(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
self.contexts.BranchCommits.SetSelectedLineIdx(0)
|
self.contexts.LocalCommits.SetSelectedLineIdx(0)
|
||||||
self.contexts.ReflogCommits.SetSelectedLineIdx(0)
|
self.contexts.ReflogCommits.SetSelectedLineIdx(0)
|
||||||
// loading a heap of commits is slow so we limit them whenever doing a reset
|
// loading a heap of commits is slow so we limit them whenever doing a reset
|
||||||
self.contexts.BranchCommits.SetLimitCommits(true)
|
self.contexts.LocalCommits.SetLimitCommits(true)
|
||||||
|
|
||||||
if err := self.c.PushContext(self.contexts.BranchCommits); err != nil {
|
if err := self.c.PushContext(self.contexts.LocalCommits); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -179,7 +179,7 @@ func (self *RefsHelper) NewBranch(from string, fromFormattedName string, suggest
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
self.contexts.BranchCommits.SetSelectedLineIdx(0)
|
self.contexts.LocalCommits.SetSelectedLineIdx(0)
|
||||||
self.contexts.Branches.SetSelectedLineIdx(0)
|
self.contexts.Branches.SetSelectedLineIdx(0)
|
||||||
|
|
||||||
return self.c.Refresh(types.RefreshOptions{Mode: types.ASYNC})
|
return self.c.Refresh(types.RefreshOptions{Mode: types.ASYNC})
|
||||||
|
|
|
@ -746,7 +746,7 @@ func (self *LocalCommitsController) Context() types.Context {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *LocalCommitsController) context() *context.LocalCommitsContext {
|
func (self *LocalCommitsController) context() *context.LocalCommitsContext {
|
||||||
return self.contexts.BranchCommits
|
return self.contexts.LocalCommits
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *LocalCommitsController) newBranch(commit *models.Commit) error {
|
func (self *LocalCommitsController) newBranch(commit *models.Commit) error {
|
||||||
|
|
|
@ -44,7 +44,7 @@ func (gui *Gui) resolveTemplate(templateStr string, promptResponses []string) (s
|
||||||
objects := CustomCommandObjects{
|
objects := CustomCommandObjects{
|
||||||
SelectedFile: gui.getSelectedFile(),
|
SelectedFile: gui.getSelectedFile(),
|
||||||
SelectedPath: gui.getSelectedPath(),
|
SelectedPath: gui.getSelectedPath(),
|
||||||
SelectedLocalCommit: gui.State.Contexts.BranchCommits.GetSelected(),
|
SelectedLocalCommit: gui.State.Contexts.LocalCommits.GetSelected(),
|
||||||
SelectedReflogCommit: gui.State.Contexts.ReflogCommits.GetSelected(),
|
SelectedReflogCommit: gui.State.Contexts.ReflogCommits.GetSelected(),
|
||||||
SelectedLocalBranch: gui.State.Contexts.Branches.GetSelected(),
|
SelectedLocalBranch: gui.State.Contexts.Branches.GetSelected(),
|
||||||
SelectedRemoteBranch: gui.State.Contexts.RemoteBranches.GetSelected(),
|
SelectedRemoteBranch: gui.State.Contexts.RemoteBranches.GetSelected(),
|
||||||
|
|
|
@ -11,7 +11,7 @@ var CONTEXT_KEYS_SHOWING_DIFFS = []types.ContextKey{
|
||||||
context.FILES_CONTEXT_KEY,
|
context.FILES_CONTEXT_KEY,
|
||||||
context.COMMIT_FILES_CONTEXT_KEY,
|
context.COMMIT_FILES_CONTEXT_KEY,
|
||||||
context.STASH_CONTEXT_KEY,
|
context.STASH_CONTEXT_KEY,
|
||||||
context.BRANCH_COMMITS_CONTEXT_KEY,
|
context.LOCAL_COMMITS_CONTEXT_KEY,
|
||||||
context.SUB_COMMITS_CONTEXT_KEY,
|
context.SUB_COMMITS_CONTEXT_KEY,
|
||||||
context.MAIN_STAGING_CONTEXT_KEY,
|
context.MAIN_STAGING_CONTEXT_KEY,
|
||||||
context.MAIN_PATCH_BUILDING_CONTEXT_KEY,
|
context.MAIN_PATCH_BUILDING_CONTEXT_KEY,
|
||||||
|
|
|
@ -46,11 +46,11 @@ func (gui *Gui) setFiltering(path string) error {
|
||||||
gui.State.ScreenMode = SCREEN_HALF
|
gui.State.ScreenMode = SCREEN_HALF
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := gui.c.PushContext(gui.State.Contexts.BranchCommits); err != nil {
|
if err := gui.c.PushContext(gui.State.Contexts.LocalCommits); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
return gui.c.Refresh(types.RefreshOptions{Scope: []types.RefreshableView{types.COMMITS}, Then: func() {
|
return gui.c.Refresh(types.RefreshOptions{Scope: []types.RefreshableView{types.COMMITS}, Then: func() {
|
||||||
gui.State.Contexts.BranchCommits.SetSelectedLineIdx(0)
|
gui.State.Contexts.LocalCommits.SetSelectedLineIdx(0)
|
||||||
}})
|
}})
|
||||||
}
|
}
|
||||||
|
|
|
@ -278,7 +278,7 @@ type guiMutexes struct {
|
||||||
RefreshingFilesMutex *sync.Mutex
|
RefreshingFilesMutex *sync.Mutex
|
||||||
RefreshingStatusMutex *sync.Mutex
|
RefreshingStatusMutex *sync.Mutex
|
||||||
SyncMutex *sync.Mutex
|
SyncMutex *sync.Mutex
|
||||||
BranchCommitsMutex *sync.Mutex
|
LocalCommitsMutex *sync.Mutex
|
||||||
LineByLinePanelMutex *sync.Mutex
|
LineByLinePanelMutex *sync.Mutex
|
||||||
SubprocessMutex *sync.Mutex
|
SubprocessMutex *sync.Mutex
|
||||||
}
|
}
|
||||||
|
@ -337,7 +337,7 @@ func (gui *Gui) resetState(filterPath string, reuseState bool) {
|
||||||
var initialContext types.IListContext = contextTree.Files
|
var initialContext types.IListContext = contextTree.Files
|
||||||
if filterPath != "" {
|
if filterPath != "" {
|
||||||
screenMode = SCREEN_HALF
|
screenMode = SCREEN_HALF
|
||||||
initialContext = contextTree.BranchCommits
|
initialContext = contextTree.LocalCommits
|
||||||
}
|
}
|
||||||
|
|
||||||
viewContextMap := context.NewViewContextMap()
|
viewContextMap := context.NewViewContextMap()
|
||||||
|
@ -397,7 +397,7 @@ func initialViewContextMapping(contextTree *context.ContextTree) map[string]type
|
||||||
"status": contextTree.Status,
|
"status": contextTree.Status,
|
||||||
"files": contextTree.Files,
|
"files": contextTree.Files,
|
||||||
"branches": contextTree.Branches,
|
"branches": contextTree.Branches,
|
||||||
"commits": contextTree.BranchCommits,
|
"commits": contextTree.LocalCommits,
|
||||||
"commitFiles": contextTree.CommitFiles,
|
"commitFiles": contextTree.CommitFiles,
|
||||||
"stash": contextTree.Stash,
|
"stash": contextTree.Stash,
|
||||||
"menu": contextTree.Menu,
|
"menu": contextTree.Menu,
|
||||||
|
@ -440,7 +440,7 @@ func NewGui(
|
||||||
RefreshingFilesMutex: &sync.Mutex{},
|
RefreshingFilesMutex: &sync.Mutex{},
|
||||||
RefreshingStatusMutex: &sync.Mutex{},
|
RefreshingStatusMutex: &sync.Mutex{},
|
||||||
SyncMutex: &sync.Mutex{},
|
SyncMutex: &sync.Mutex{},
|
||||||
BranchCommitsMutex: &sync.Mutex{},
|
LocalCommitsMutex: &sync.Mutex{},
|
||||||
LineByLinePanelMutex: &sync.Mutex{},
|
LineByLinePanelMutex: &sync.Mutex{},
|
||||||
SubprocessMutex: &sync.Mutex{},
|
SubprocessMutex: &sync.Mutex{},
|
||||||
},
|
},
|
||||||
|
@ -579,7 +579,7 @@ func (gui *Gui) resetControllers() {
|
||||||
controllers.AttachControllers(gui.State.Contexts.Files, gui.Controllers.Files)
|
controllers.AttachControllers(gui.State.Contexts.Files, gui.Controllers.Files)
|
||||||
controllers.AttachControllers(gui.State.Contexts.Tags, gui.Controllers.Tags)
|
controllers.AttachControllers(gui.State.Contexts.Tags, gui.Controllers.Tags)
|
||||||
controllers.AttachControllers(gui.State.Contexts.Submodules, gui.Controllers.Submodules)
|
controllers.AttachControllers(gui.State.Contexts.Submodules, gui.Controllers.Submodules)
|
||||||
controllers.AttachControllers(gui.State.Contexts.BranchCommits, gui.Controllers.LocalCommits, bisectController)
|
controllers.AttachControllers(gui.State.Contexts.LocalCommits, gui.Controllers.LocalCommits, bisectController)
|
||||||
controllers.AttachControllers(gui.State.Contexts.Remotes, gui.Controllers.Remotes)
|
controllers.AttachControllers(gui.State.Contexts.Remotes, gui.Controllers.Remotes)
|
||||||
controllers.AttachControllers(gui.State.Contexts.Menu, gui.Controllers.Menu)
|
controllers.AttachControllers(gui.State.Contexts.Menu, gui.Controllers.Menu)
|
||||||
controllers.AttachControllers(gui.State.Contexts.Global, gui.Controllers.Sync, gui.Controllers.Undo, gui.Controllers.Global)
|
controllers.AttachControllers(gui.State.Contexts.Global, gui.Controllers.Sync, gui.Controllers.Undo, gui.Controllers.Global)
|
||||||
|
|
|
@ -412,14 +412,14 @@ func (self *Gui) GetInitialKeybindings() ([]*types.Binding, []*gocui.ViewMouseBi
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "commits",
|
ViewName: "commits",
|
||||||
Contexts: []string{string(context.BRANCH_COMMITS_CONTEXT_KEY)},
|
Contexts: []string{string(context.LOCAL_COMMITS_CONTEXT_KEY)},
|
||||||
Key: opts.GetKey(opts.Config.Universal.CopyToClipboard),
|
Key: opts.GetKey(opts.Config.Universal.CopyToClipboard),
|
||||||
Handler: self.handleCopySelectedSideContextItemToClipboard,
|
Handler: self.handleCopySelectedSideContextItemToClipboard,
|
||||||
Description: self.c.Tr.LcCopyCommitShaToClipboard,
|
Description: self.c.Tr.LcCopyCommitShaToClipboard,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "commits",
|
ViewName: "commits",
|
||||||
Contexts: []string{string(context.BRANCH_COMMITS_CONTEXT_KEY)},
|
Contexts: []string{string(context.LOCAL_COMMITS_CONTEXT_KEY)},
|
||||||
Key: opts.GetKey(opts.Config.Commits.ResetCherryPick),
|
Key: opts.GetKey(opts.Config.Commits.ResetCherryPick),
|
||||||
Handler: self.helpers.CherryPick.Reset,
|
Handler: self.helpers.CherryPick.Reset,
|
||||||
Description: self.c.Tr.LcResetCherryPick,
|
Description: self.c.Tr.LcResetCherryPick,
|
||||||
|
|
|
@ -114,8 +114,8 @@ func (gui *Gui) branchCommitsListContext() *context.LocalCommitsContext {
|
||||||
gui.Views.Commits,
|
gui.Views.Commits,
|
||||||
func(startIdx int, length int) [][]string {
|
func(startIdx int, length int) [][]string {
|
||||||
selectedCommitSha := ""
|
selectedCommitSha := ""
|
||||||
if gui.currentContext().GetKey() == context.BRANCH_COMMITS_CONTEXT_KEY {
|
if gui.currentContext().GetKey() == context.LOCAL_COMMITS_CONTEXT_KEY {
|
||||||
selectedCommit := gui.State.Contexts.BranchCommits.GetSelected()
|
selectedCommit := gui.State.Contexts.LocalCommits.GetSelected()
|
||||||
if selectedCommit != nil {
|
if selectedCommit != nil {
|
||||||
selectedCommitSha = selectedCommit.Sha
|
selectedCommitSha = selectedCommit.Sha
|
||||||
}
|
}
|
||||||
|
@ -266,7 +266,7 @@ func (gui *Gui) submodulesListContext() *context.SubmodulesContext {
|
||||||
func (gui *Gui) suggestionsListContext() *context.SuggestionsContext {
|
func (gui *Gui) suggestionsListContext() *context.SuggestionsContext {
|
||||||
return context.NewSuggestionsContext(
|
return context.NewSuggestionsContext(
|
||||||
func() []*types.Suggestion { return gui.State.Suggestions },
|
func() []*types.Suggestion { return gui.State.Suggestions },
|
||||||
gui.Views.Files,
|
gui.Views.Suggestions,
|
||||||
func(startIdx int, length int) [][]string {
|
func(startIdx int, length int) [][]string {
|
||||||
return presentation.GetSuggestionListDisplayStrings(gui.State.Suggestions)
|
return presentation.GetSuggestionListDisplayStrings(gui.State.Suggestions)
|
||||||
},
|
},
|
||||||
|
@ -285,7 +285,7 @@ func (gui *Gui) getListContexts() []types.IListContext {
|
||||||
gui.State.Contexts.Remotes,
|
gui.State.Contexts.Remotes,
|
||||||
gui.State.Contexts.RemoteBranches,
|
gui.State.Contexts.RemoteBranches,
|
||||||
gui.State.Contexts.Tags,
|
gui.State.Contexts.Tags,
|
||||||
gui.State.Contexts.BranchCommits,
|
gui.State.Contexts.LocalCommits,
|
||||||
gui.State.Contexts.ReflogCommits,
|
gui.State.Contexts.ReflogCommits,
|
||||||
gui.State.Contexts.SubCommits,
|
gui.State.Contexts.SubCommits,
|
||||||
gui.State.Contexts.Stash,
|
gui.State.Contexts.Stash,
|
||||||
|
|
|
@ -44,7 +44,7 @@ func (gui *Gui) handleCreatePatchOptionsMenu() error {
|
||||||
},
|
},
|
||||||
}...)
|
}...)
|
||||||
|
|
||||||
if gui.currentContext().GetKey() == gui.State.Contexts.BranchCommits.GetKey() {
|
if gui.currentContext().GetKey() == gui.State.Contexts.LocalCommits.GetKey() {
|
||||||
selectedCommit := gui.getSelectedLocalCommit()
|
selectedCommit := gui.getSelectedLocalCommit()
|
||||||
if selectedCommit != nil && gui.git.Patch.PatchManager.To != selectedCommit.Sha {
|
if selectedCommit != nil && gui.git.Patch.PatchManager.To != selectedCommit.Sha {
|
||||||
// adding this option to index 1
|
// adding this option to index 1
|
||||||
|
@ -118,7 +118,7 @@ func (gui *Gui) handleMovePatchToSelectedCommit() error {
|
||||||
return gui.c.WithWaitingStatus(gui.c.Tr.RebasingStatus, func() error {
|
return gui.c.WithWaitingStatus(gui.c.Tr.RebasingStatus, func() error {
|
||||||
commitIndex := gui.getPatchCommitIndex()
|
commitIndex := gui.getPatchCommitIndex()
|
||||||
gui.c.LogAction(gui.c.Tr.Actions.MovePatchToSelectedCommit)
|
gui.c.LogAction(gui.c.Tr.Actions.MovePatchToSelectedCommit)
|
||||||
err := gui.git.Patch.MovePatchToSelectedCommit(gui.State.Model.Commits, commitIndex, gui.State.Contexts.BranchCommits.GetSelectedLineIdx())
|
err := gui.git.Patch.MovePatchToSelectedCommit(gui.State.Model.Commits, commitIndex, gui.State.Contexts.LocalCommits.GetSelectedLineIdx())
|
||||||
return gui.helpers.MergeAndRebase.CheckMergeOrRebase(err)
|
return gui.helpers.MergeAndRebase.CheckMergeOrRebase(err)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -186,7 +186,7 @@ func (gui *Gui) refreshCommits() {
|
||||||
go utils.Safe(func() {
|
go utils.Safe(func() {
|
||||||
_ = gui.refreshCommitsWithLimit()
|
_ = gui.refreshCommitsWithLimit()
|
||||||
ctx, ok := gui.State.Contexts.CommitFiles.GetParentContext()
|
ctx, ok := gui.State.Contexts.CommitFiles.GetParentContext()
|
||||||
if ok && ctx.GetKey() == context.BRANCH_COMMITS_CONTEXT_KEY {
|
if ok && ctx.GetKey() == context.LOCAL_COMMITS_CONTEXT_KEY {
|
||||||
// This makes sense when we've e.g. just amended a commit, meaning we get a new commit SHA at the same position.
|
// This makes sense when we've e.g. just amended a commit, meaning we get a new commit SHA at the same position.
|
||||||
// However if we've just added a brand new commit, it pushes the list down by one and so we would end up
|
// However if we've just added a brand new commit, it pushes the list down by one and so we would end up
|
||||||
// showing the contents of a different commit than the one we initially entered.
|
// showing the contents of a different commit than the one we initially entered.
|
||||||
|
@ -206,16 +206,16 @@ func (gui *Gui) refreshCommits() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (gui *Gui) refreshCommitsWithLimit() error {
|
func (gui *Gui) refreshCommitsWithLimit() error {
|
||||||
gui.Mutexes.BranchCommitsMutex.Lock()
|
gui.Mutexes.LocalCommitsMutex.Lock()
|
||||||
defer gui.Mutexes.BranchCommitsMutex.Unlock()
|
defer gui.Mutexes.LocalCommitsMutex.Unlock()
|
||||||
|
|
||||||
commits, err := gui.git.Loaders.Commits.GetCommits(
|
commits, err := gui.git.Loaders.Commits.GetCommits(
|
||||||
loaders.GetCommitsOptions{
|
loaders.GetCommitsOptions{
|
||||||
Limit: gui.State.Contexts.BranchCommits.GetLimitCommits(),
|
Limit: gui.State.Contexts.LocalCommits.GetLimitCommits(),
|
||||||
FilterPath: gui.State.Modes.Filtering.GetPath(),
|
FilterPath: gui.State.Modes.Filtering.GetPath(),
|
||||||
IncludeRebaseCommits: true,
|
IncludeRebaseCommits: true,
|
||||||
RefName: gui.refForLog(),
|
RefName: gui.refForLog(),
|
||||||
All: gui.State.Contexts.BranchCommits.GetShowWholeGitGraph(),
|
All: gui.State.Contexts.LocalCommits.GetShowWholeGitGraph(),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -223,12 +223,12 @@ func (gui *Gui) refreshCommitsWithLimit() error {
|
||||||
}
|
}
|
||||||
gui.State.Model.Commits = commits
|
gui.State.Model.Commits = commits
|
||||||
|
|
||||||
return gui.c.PostRefreshUpdate(gui.State.Contexts.BranchCommits)
|
return gui.c.PostRefreshUpdate(gui.State.Contexts.LocalCommits)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (gui *Gui) refreshRebaseCommits() error {
|
func (gui *Gui) refreshRebaseCommits() error {
|
||||||
gui.Mutexes.BranchCommitsMutex.Lock()
|
gui.Mutexes.LocalCommitsMutex.Lock()
|
||||||
defer gui.Mutexes.BranchCommitsMutex.Unlock()
|
defer gui.Mutexes.LocalCommitsMutex.Unlock()
|
||||||
|
|
||||||
updatedCommits, err := gui.git.Loaders.Commits.MergeRebasingCommits(gui.State.Model.Commits)
|
updatedCommits, err := gui.git.Loaders.Commits.MergeRebasingCommits(gui.State.Model.Commits)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -236,7 +236,7 @@ func (gui *Gui) refreshRebaseCommits() error {
|
||||||
}
|
}
|
||||||
gui.State.Model.Commits = updatedCommits
|
gui.State.Model.Commits = updatedCommits
|
||||||
|
|
||||||
return gui.c.PostRefreshUpdate(gui.State.Contexts.BranchCommits)
|
return gui.c.PostRefreshUpdate(gui.State.Contexts.LocalCommits)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *Gui) refreshTags() error {
|
func (self *Gui) refreshTags() error {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue