MCPcopy Create free account
hub / github.com/Autodesk/AutomaticComponentToolkit / diffComponentAttributes

Function diffComponentAttributes

Source/componentdiff.go:677–709  ·  view source on GitHub ↗
(path string, componentA ComponentDefinition, componentB ComponentDefinition)

Source from the content-addressed store, hash-verified

675
676
677func diffComponentAttributes(path string, componentA ComponentDefinition, componentB ComponentDefinition) ([]ComponentDiffAttributeChange, error) {
678 changes := make([]ComponentDiffAttributeChange, 0)
679
680 if (componentA.Year != componentB.Year) {
681 var change ComponentDiffAttributeChange
682 change.Path = path + "/year"
683 change.OldValue = string(componentA.Year)
684 change.NewValue = string(componentB.Year)
685 changes = append(changes, change)
686 }
687 if (componentA.NameSpace != componentB.NameSpace) {
688 var change ComponentDiffAttributeChange
689 change.Path = path + "/namespace"
690 change.OldValue = componentA.NameSpace
691 change.NewValue = componentB.NameSpace
692 changes = append(changes, change)
693 }
694 if (componentA.LibraryName != componentB.LibraryName) {
695 var change ComponentDiffAttributeChange
696 change.Path = path + "/libraryname"
697 change.OldValue = componentA.LibraryName
698 change.NewValue = componentB.LibraryName
699 changes = append(changes, change)
700 }
701 if (componentA.BaseName != componentB.BaseName) {
702 var change ComponentDiffAttributeChange
703 change.Path = path + "/basename"
704 change.OldValue = componentA.BaseName
705 change.NewValue = componentB.BaseName
706 changes = append(changes, change)
707 }
708 return changes, nil
709}
710
711// DiffComponentDefinitions generates a diff D = B - A between component definitions A and B such that A + D = B
712func DiffComponentDefinitions(A ComponentDefinition, B ComponentDefinition) (ComponentDiff, error) {

Callers 1

DiffComponentDefinitionsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected