Documentation
¶
Overview ¶
Package diff3 implements a three-way merge algorithm Original version in Javascript by Bryan Housel @bhousel: https://github.com/bhousel/node-diff3, which in turn is based on project Synchrotron, created by Tony Garnock-Jones. For more detail please visit: http://homepages.kcbbs.gen.nz/tonyg/projects/synchrotron.html https://github.com/tonyg/synchrotron
Ported to go by Javier Peletier @jpeletier
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Diff3MergeResult ¶
Diff3MergeResult describes a merge result.
func Diff3Merge ¶
func Diff3Merge[T comparable](a, o, b []T, excludeFalseConflicts bool) []*Diff3MergeResult[T]
Diff3Merge applies the output of diff3MergeIndices to actually construct the merged file; the returned result alternates between 'ok' and 'conflict' blocks.
func Diff3MergeWithOptions ¶
func Diff3MergeWithOptions[T comparable](a, o, b []T, opts MergeOptions) []*Diff3MergeResult[T]
type DiffAlgorithm ¶
type DiffAlgorithm int
const ( DiffAlgorithmLCS DiffAlgorithm = iota DiffAlgorithmMyers )
type DiffResult ¶
type DiffResult[T any] struct { Common []T File1 []T File2 []T }
func DiffComm ¶
func DiffComm[T comparable](file1, file2 []T) []*DiffResult[T]
We apply the LCS to build a 'comm'-style picture of the differences between file1 and file2.
type MergeOptions ¶
type MergeOptions struct {
Algorithm DiffAlgorithm
ExcludeFalseConflicts bool
Detailed bool
LabelA string
LabelB string
}
type MergeResult ¶
type MergeResult struct {
Conflicts bool // Conflict indicates if there is any merge conflict
Result io.Reader // returns a reader that contains the merge result
}
MergeResult describes a merge result
func MergeWithOptions ¶
func MergeWithOptions(a, o, b io.Reader, opts MergeOptions) (*MergeResult, error)