MCPcopy Create free account
hub / github.com/dolthub/doltgresql / HandleMerge

Method HandleMerge

core/functions/collection_funcs.go:39–68  ·  view source on GitHub ↗

HandleMerge implements the interface objinterface.Collection.

(ctx context.Context, mro merge.MergeRootObject)

Source from the content-addressed store, hash-verified

37
38// HandleMerge implements the interface objinterface.Collection.
39func (*Collection) HandleMerge(ctx context.Context, mro merge.MergeRootObject) (doltdb.RootObject, *merge.MergeStats, error) {
40 ourFunc := mro.OurRootObj.(Function)
41 theirFunc := mro.TheirRootObj.(Function)
42 // Ensure that they have the same identifier
43 if ourFunc.ID != theirFunc.ID {
44 return nil, nil, errors.Newf("attempted to merge different functions: `%s` and `%s`",
45 ourFunc.Name().String(), theirFunc.Name().String())
46 }
47 ourHash, err := ourFunc.HashOf(ctx)
48 if err != nil {
49 return nil, nil, err
50 }
51 theirHash, err := theirFunc.HashOf(ctx)
52 if err != nil {
53 return nil, nil, err
54 }
55 if ourHash.Equal(theirHash) {
56 return mro.OurRootObj, &merge.MergeStats{
57 Operation: merge.TableUnmodified,
58 Adds: 0,
59 Deletes: 0,
60 Modifications: 0,
61 DataConflicts: 0,
62 SchemaConflicts: 0,
63 RootObjectConflicts: 0,
64 ConstraintViolations: 0,
65 }, nil
66 }
67 return pgmerge.CreateConflict(ctx, mro.RightSrc, ourFunc, theirFunc, mro.AncestorRootObj)
68}
69
70// LoadCollection implements the interface objinterface.Collection.
71func (*Collection) LoadCollection(ctx context.Context, root objinterface.RootValue) (objinterface.Collection, error) {

Callers

nothing calls this directly

Calls 4

StringMethod · 0.65
NameMethod · 0.65
HashOfMethod · 0.45
EqualMethod · 0.45

Tested by

no test coverage detected