mergeconflicts

package
v0.0.0-...-00ab8b8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 15, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	CONFLICT_START       = "<<<<<<< "
	CONFLICT_END         = ">>>>>>> "
	CONFLICT_START_BYTES = []byte(CONFLICT_START)
	CONFLICT_END_BYTES   = []byte(CONFLICT_END)
)

Functions

func ColoredConflictFile

func ColoredConflictFile(state *State) string

func FileHasConflictMarkers

func FileHasConflictMarkers(path string) (bool, error)

tells us whether a file actually has inline merge conflicts. We need to run this because git will continue showing a status of 'UU' even after the conflicts have been resolved in the user's editor

Types

type LineType

type LineType int

LineType tells us whether a given line is a start/middle/end marker of a conflict, or if it's not a marker at all

const (
	START LineType = iota
	ANCESTOR
	TARGET
	END
	NOT_A_MARKER
)

type Selection

type Selection int
const (
	TOP Selection = iota
	MIDDLE
	BOTTOM
	ALL
)

type State

type State struct {
	// contains filtered or unexported fields
}

State represents the selection state of the merge conflict context.

func NewState

func NewState() *State

func (*State) Active

func (s *State) Active() bool

func (*State) AllConflictsResolved

func (s *State) AllConflictsResolved() bool

func (*State) ContentAfterConflictResolve

func (s *State) ContentAfterConflictResolve(selection Selection) (bool, string, error)

func (*State) GetConflictMiddle

func (s *State) GetConflictMiddle() int

func (*State) GetContent

func (s *State) GetContent() string

func (*State) GetPath

func (s *State) GetPath() string

func (*State) GetSelectedLine

func (s *State) GetSelectedLine() int

func (*State) GetSelectedRange

func (s *State) GetSelectedRange() (int, int)

func (*State) NoConflicts

func (s *State) NoConflicts() bool

func (*State) PlainRenderSelected

func (s *State) PlainRenderSelected() string

func (*State) PushContent

func (s *State) PushContent(content string)

this is for when you've resolved a conflict. This allows you to undo to a previous state

func (*State) Reset

func (s *State) Reset()

func (*State) ResetConflictSelection

func (s *State) ResetConflictSelection()

we're not resetting selectedIndex here because the user typically would want to pick either all top hunks or all bottom hunks so we retain that selection

func (*State) SelectNextConflict

func (s *State) SelectNextConflict()

func (*State) SelectNextConflictHunk

func (s *State) SelectNextConflictHunk()

func (*State) SelectPrevConflict

func (s *State) SelectPrevConflict()

func (*State) SelectPrevConflictHunk

func (s *State) SelectPrevConflictHunk()

func (*State) Selection

func (s *State) Selection() Selection

func (*State) SetContent

func (s *State) SetContent(content string, path string)

this is for starting a new merge conflict session

func (*State) Undo

func (s *State) Undo() bool

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL