Merge
Description: | Applies a set of changes (the output of a Diff operation) to a buffer. |
Returns: | Buffer |
Usage: | Script Only. |
Function Groups: | Configuration Management |
Related to: | Combine | Diff | Merge2 |
Format: | Merge(SourceBuff, DiffBuff) |
Parameters: |
SourceBuff |
Required. The buffer or stream to be modified. |
DiffBuff |
Required. The buffer or stream containing formatted instructions for how to modify the source buffer. |
Comments: |
The source buffer must be identical to the origin buffer used to create the Diff buffer in the first place. This operation cannot fail, but will produce unexpected results if either input buffer is corrupt or if the wrong origin buffer is used. This function is synchronous and returns the result of the operation. The operations in the DiffBuff are formatted as follows:
"DiffBuff" could be the result from the Diff function. Merge assumes that the diffs in DiffBuff are ordered and correct, hence does no checking for offsets outside SourceBuff, etc. It is the responsibility of the caller to get it right. Merge relies on "Modify" operations being ordered as an "Add" in a particular location followed by a "Delete" in the same location. This is the ordering generated by the Diff function. Reversing the order will cause undesirable results. |
Examples: