Combine

(VTScada Layer module. Obtain LayerRoot using the following script-only statement: )

    LayerRoot = \System.GetLoadedAppInstance(GetGUID(0, \LocalGUID));
Description: Performs a Merge2 operation with automated conflict resolution and change priority.
Returns: Merge buffer
Usage: Script Only. (always called as a subroutine)
Function Groups: Configuration Management
Related to: Diff | Merge2 | Merge
Format: LayerRoot\Combine(Source, Diff1, Diff2, SrcPath, pFail)
Parameters:  
Source
Required. The buffer or stream to be modified
Diff1
Required. High priority diff to merge to Source.
Diff2
Required. Low priority diff to merge to Source.
SRCPath
Required. Full file path for the origin of the Source buffer.
pFail
Required. Pointer to a variable in which an error message will be returned.
Comments:

This module must be called as a subroutine.

This function is guaranteed to return a result, however it will discard changes if unable to merge them without conflict. It is the recommended method for combining different change paths against standard VTScada file types (settings files, source files, tag files, etc.).
Changes from the high priority diff are treated preferentially to changes from the low priority diff when resolving conflicts. If the operation fails then the result will be the original buffer modified by the high priority diff only. Failure is indicated by the pFail parameter being set to a non-zero value that is typically a string detailing the type of failure.

Notes:

  • All Tag file conflicts are resolvable, Combine does not fails on tags.
  • Conflicts of Adjacency (where two change regions share an edge but do not overlap) are resolved for all non-tag files.
  • Simultaneous Addition Conflicts (where two pure addition changes coincide) are resolved for Page, Menu, Setting, and PageNote files.
  • Specific segments of AppRoot files are parsed and rebuilt allowing for all types of conflicts to be resolved, these are additionally checked for duplicate entries, which are removed.

The results of conflict resolution are passed to the Mend function to generate complete merged file buffers. This module returns a simple merge of the high priority diff and the source buffer should conflicts occur and conflict resolution fail. In this case *pFail is set to an error string that describes the failure in a human-readable form.