A set of diffs all based on a common original document.
|
Use this class to merge multiple Algorithm.Diff.Diff or Algorithm.Diff.Patch objects, all of which created based on the same base document.
The result of the merger is a list of Algorithm.Diff.Merge+Hunk objects, each of which represents a segment of the original document. A hunk can represent a range in the original document in which no changes were made in any of the revisions, or a range in which one or more of the revised documents had changes.
The hunks are accessed through a for-each over the Merge object.
| C# Example |
Merge m = new Merge("A few good men.", new string[] { "A few bad men.", "A few good women." }, null);
foreach (Merge.Hunk hunk in m) {
if (hunk.Same) {
// This region had no changes.
} else if (!hunk.Conflict) {
int idx = hunk.ChangedIndex();
if (hunk.Original().Count == 0) {
// Something was inserted in the idx'th document
WriteList(hunk.Range(idx));
} else if (hunk.Range(idx).Count == 0) {
// Something was deleted in the idx'th document
WriteList(hunk.Original());
} else {
// The hunk was a normal change
WriteList(hunk.Original());
WriteList(hunk.Range(idx));
}
} else {
// There was a conflict.
}
|
See Also: Inherited members from object.
| Performs a merge of the provided diffs. The base document must be the left list in each diff. |
| Computes how to merge the changes between an original document and a collection of revised versions using the object. |
| Computes how to merge the changes between an original document and a collection of revised versions. |
| static |
MergeLists
(IList, IList[], IComparer, IHashCodeProvider) Returns a new document that is the merger of the changes from the set of revised documents over the original. |
Computes how to merge the changes between an original document and a collection of revised versions.
Returns a new document that is the merger of the changes from the set of revised documents over the original.
Computes how to merge the changes between an original document and a collection of revised versions using the object.
Performs a merge of the provided diffs. The base document must be the left list in each diff.