diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2021-04-10 16:01:46 +1000 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2021-04-11 17:07:49 +1000 |
commit | bb918b579a3073d786fda83a2bc11c602e442aa0 (patch) | |
tree | fe126f12a88db9a9e119d0b172c0902bc0f49244 /pkg/gui/patch_options_panel.go | |
parent | e145090046e1693e2100cb0a0ab40a271705f4b0 (diff) |
start adding support for logging of commands
Diffstat (limited to 'pkg/gui/patch_options_panel.go')
-rw-r--r-- | pkg/gui/patch_options_panel.go | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/pkg/gui/patch_options_panel.go b/pkg/gui/patch_options_panel.go index 90f72fc37..1d31b7e60 100644 --- a/pkg/gui/patch_options_panel.go +++ b/pkg/gui/patch_options_panel.go @@ -33,11 +33,11 @@ func (gui *Gui) handleCreatePatchOptionsMenu() error { onPress: gui.handleDeletePatchFromCommit, }, { - displayString: "pull patch out into index", - onPress: gui.handlePullPatchIntoWorkingTree, + displayString: "move patch out into index", + onPress: gui.handleMovePatchIntoWorkingTree, }, { - displayString: "pull patch into new commit", + displayString: "move patch into new commit", onPress: gui.handlePullPatchIntoNewCommit, }, }...) @@ -98,7 +98,7 @@ func (gui *Gui) handleDeletePatchFromCommit() error { return gui.WithWaitingStatus(gui.Tr.RebasingStatus, func() error { commitIndex := gui.getPatchCommitIndex() - err := gui.GitCommand.DeletePatchesFromCommit(gui.State.Commits, commitIndex, gui.GitCommand.PatchManager) + err := gui.GitCommand.WithSpan("Remove patch from commit").DeletePatchesFromCommit(gui.State.Commits, commitIndex, gui.GitCommand.PatchManager) return gui.handleGenericMergeCommandResult(err) }) } @@ -114,12 +114,12 @@ func (gui *Gui) handleMovePatchToSelectedCommit() error { return gui.WithWaitingStatus(gui.Tr.RebasingStatus, func() error { commitIndex := gui.getPatchCommitIndex() - err := gui.GitCommand.MovePatchToSelectedCommit(gui.State.Commits, commitIndex, gui.State.Panels.Commits.SelectedLineIdx, gui.GitCommand.PatchManager) + err := gui.GitCommand.WithSpan("Move patch to selected commit").MovePatchToSelectedCommit(gui.State.Commits, commitIndex, gui.State.Panels.Commits.SelectedLineIdx, gui.GitCommand.PatchManager) return gui.handleGenericMergeCommandResult(err) }) } -func (gui *Gui) handlePullPatchIntoWorkingTree() error { +func (gui *Gui) handleMovePatchIntoWorkingTree() error { if ok, err := gui.validateNormalWorkingTreeState(); !ok { return err } @@ -131,7 +131,7 @@ func (gui *Gui) handlePullPatchIntoWorkingTree() error { pull := func(stash bool) error { return gui.WithWaitingStatus(gui.Tr.RebasingStatus, func() error { commitIndex := gui.getPatchCommitIndex() - err := gui.GitCommand.PullPatchIntoIndex(gui.State.Commits, commitIndex, gui.GitCommand.PatchManager, stash) + err := gui.GitCommand.WithSpan("Move patch into index").MovePatchIntoIndex(gui.State.Commits, commitIndex, gui.GitCommand.PatchManager, stash) return gui.handleGenericMergeCommandResult(err) }) } @@ -160,7 +160,7 @@ func (gui *Gui) handlePullPatchIntoNewCommit() error { return gui.WithWaitingStatus(gui.Tr.RebasingStatus, func() error { commitIndex := gui.getPatchCommitIndex() - err := gui.GitCommand.PullPatchIntoNewCommit(gui.State.Commits, commitIndex, gui.GitCommand.PatchManager) + err := gui.GitCommand.WithSpan("Move patch into new commit").PullPatchIntoNewCommit(gui.State.Commits, commitIndex, gui.GitCommand.PatchManager) return gui.handleGenericMergeCommandResult(err) }) } @@ -170,7 +170,11 @@ func (gui *Gui) handleApplyPatch(reverse bool) error { return err } - if err := gui.GitCommand.PatchManager.ApplyPatches(reverse); err != nil { + span := "Apply patch" + if reverse { + span = "Apply patch in reverse" + } + if err := gui.GitCommand.WithSpan(span).PatchManager.ApplyPatches(reverse); err != nil { return gui.surfaceError(err) } return gui.refreshSidePanels(refreshOptions{mode: ASYNC}) |