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

Function diffGlobal

Source/componentdiff.go:469–538  ·  view source on GitHub ↗
(path string, globalA ComponentDefinitionGlobal, globalB ComponentDefinitionGlobal)

Source from the content-addressed store, hash-verified

467
468
469func diffGlobal(path string, globalA ComponentDefinitionGlobal, globalB ComponentDefinitionGlobal) ([]ComponentDiffElementAdd, []ComponentDiffElementRemove, []ComponentDiffAttributeChange, error) {
470 changes := make([]ComponentDiffAttributeChange, 0)
471 adds := make([]ComponentDiffElementAdd, 0)
472 removes := make([]ComponentDiffElementRemove, 0)
473
474 pathA := path + "/global"
475 pathB := path + "/global"
476 if (globalA.JournalMethod != globalB.JournalMethod) {
477 var change ComponentDiffAttributeChange
478 change.Path = pathA + "/journalmethod"
479 change.OldValue = globalA.JournalMethod
480 change.NewValue = globalB.JournalMethod
481 changes = append(changes, change)
482 }
483 if (globalA.ReleaseMethod != globalB.ReleaseMethod) {
484 var change ComponentDiffAttributeChange
485 change.Path = pathA + "/releasemethod"
486 change.OldValue = globalA.ReleaseMethod
487 change.NewValue = globalB.ReleaseMethod
488 changes = append(changes, change)
489 }
490 if (globalA.VersionMethod != globalB.VersionMethod) {
491 var change ComponentDiffAttributeChange
492 change.Path = pathA + "/versionmethod"
493 change.OldValue = globalA.VersionMethod
494 change.NewValue = globalB.VersionMethod
495 changes = append(changes, change)
496 }
497
498 for _, methodA := range(globalA.Methods) {
499 BHasMethodA := false
500 for _, methodB := range(globalB.Methods) {
501 if methodA.MethodName == methodB.MethodName {
502 BHasMethodA = true
503 Madds, Mremoves, Mchanges, err := diffMethod(pathA, methodA, methodB)
504 if (err != nil) {
505 return adds, removes, changes, err
506 }
507 adds = append(adds, Madds...)
508 removes = append(removes, Mremoves...)
509 changes = append(changes, Mchanges...)
510 break;
511 }
512 }
513 if (!BHasMethodA) {
514 var remove ComponentDiffElementRemove
515 remove.Path = path
516 remove.Removal = methodA
517 removes = append(removes, remove)
518 }
519 }
520
521 for _, methodB := range(globalB.Methods) {
522 AHasMethodB := false
523 for _, methodA := range(globalA.Methods) {
524 if methodA.MethodName == methodB.MethodName {
525 AHasMethodB = true
526 break;

Callers 1

DiffComponentDefinitionsFunction · 0.85

Calls 1

diffMethodFunction · 0.85

Tested by

no test coverage detected