merge

package
v0.51.2 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CreateConflict = func(ctx context.Context, rightSrc doltdb.Rootish, ours doltdb.RootObject, theirs doltdb.RootObject, ancestor doltdb.RootObject) (doltdb.RootObject, *merge.MergeStats, error) {
	return nil, nil, errors.New("CreateConflict was never initialized")
}

CreateConflict handles conflict creation and is declared in a different package. It is assigned here by an Init function to get around import cycles.

Functions

func DiffValues added in v0.51.1

func DiffValues[T comparable](diff *objinterface.RootObjectDiff, ourVal, theirVal, ancVal T, hasAncestorValue bool) bool

DiffValues handles common comparisons for diffs. This makes an assumption that "our" and "their" values are always valid. Returns true when the diff represents a conflict. When false is returned, the diff's "our" value contains the merged value.

func DiffValuesFunc added in v0.51.1

func DiffValuesFunc[T any](diff *objinterface.RootObjectDiff, ourVal, theirVal, ancVal T, hasAncestorValue bool, equals func(T, T) bool) bool

DiffValuesFunc is the same as DiffValues, except that this handles values that are not trivially comparable.

func ResolveMergeValues

func ResolveMergeValues[T comparable](ourVal, theirVal, ancVal T, hasAncestorValue bool, customResolve func(T, T) T) T

ResolveMergeValues is a way to handle merging between "our" value and "their" value. This will always take the changed value if one side has changed from the "ancestor" while the other has not. If both have changed (or the ancestor does not exist), then this defers to a custom resolution function. This function is only called when both "our" and "their" values have changed from the ancestor.

func ResolveMergeValuesVariadic

func ResolveMergeValuesVariadic[T comparable](ourVal, theirVal, ancVal T, hasAncestorValue bool, customResolve func(...T) T) T

ResolveMergeValuesVariadic is the same as ResolveMergeValues, except that it will take a variadic custom resolution function. This is primarily for values that will use one of the variadic utility functions (Min, Max, etc.) as it will always receive two inputs. If Go expands how functions interact with generics, then this function can be removed.

Types

This section is empty.

Jump to

Keyboard shortcuts

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