if (!honorMergeInfo || myIsRecordOnly) {
for (ListIterator childrenIter = childrenWithMergeInfo.listIterator(); childrenIter.hasNext();) {
MergePath child = (MergePath) childrenIter.next();
SVNMergeRange range = new SVNMergeRange(revision1, revision2, true);
child.myRemainingRanges = new SVNMergeRangeList(range);
}
return;
}
long[] gap = new long[2];
findGapsInMergeSourceHistory(gap, parentMergeSrcCanonPath, url1, revision1, url2, revision2, repository);
if (gap[0] >= 0 && gap[1] >= 0) {
myImplicitSrcGap = new SVNMergeRangeList(gap[0], gap[1], true);
}
int index = 0;
for (ListIterator childrenIter = childrenWithMergeInfo.listIterator(); childrenIter.hasNext();) {
MergePath child = (MergePath) childrenIter.next();
if (child == null || child.myIsAbsent) {
index++;
continue;
}
String childRelativePath = null;
if (myTarget.equals(child.myPath)) {
childRelativePath = "";
} else {
childRelativePath = SVNPathUtil.getRelativePath(myTarget.getAbsolutePath(),
child.myPath.getAbsolutePath());
}
MergePath parent = null;
SVNURL childURL1 = url1.appendPath(childRelativePath, false);
SVNURL childURL2 = url2.appendPath(childRelativePath, false);
SVNEntry childEntry = myWCAccess.getVersionedEntry(child.myPath, false);
boolean indirect[] = { false };
Map mergeInfo[] = getFullMergeInfo(childEntry, indirect, SVNMergeInfoInheritance.INHERITED,
repository, child.myPath, Math.max(revision1, revision2), Math.min(revision1, revision2));
child.myPreMergeMergeInfo = mergeInfo[0];
child.myImplicitMergeInfo = mergeInfo[1];
child.myIsIndirectMergeInfo = indirect[0];
if (index > 0) {
Object[] childrenWithMergeInfoArray = childrenWithMergeInfo.toArray();
int parentIndex = findNearestAncestor(childrenWithMergeInfoArray, false, child.myPath);
if (parentIndex >= 0 && parentIndex < childrenWithMergeInfoArray.length) {
parent = (MergePath) childrenWithMergeInfoArray[parentIndex];
}
}
calculateRemainingRanges(parent, child, sourceRootURL, childURL1, revision1,
childURL2, revision2, child.myPreMergeMergeInfo, child.myImplicitMergeInfo, myImplicitSrcGap,
index > 0, childEntry, repository);
if (child.myRemainingRanges.getSize() > 0 && myImplicitSrcGap != null) {
long start, end;
boolean properSubset = false;
boolean equals = false;
boolean overlapsOrAdjoins = false;
if (revision1 > revision2) {
child.myRemainingRanges.reverse();
}
for(int j = 0; j < child.myRemainingRanges.getSize(); j++) {
start = child.myRemainingRanges.getRanges()[j].getStartRevision();
end = child.myRemainingRanges.getRanges()[j].getEndRevision();
if ((start <= gap[0] && gap[1] < end) || (start < gap[0] && gap[1] <= end)) {
properSubset = true;
break;
} else if (gap[0] == start && gap[1] == end) {
equals = true;
break;
} else if (gap[0] <= end && start <= gap[1]) {
overlapsOrAdjoins = true;
break;
}
}
if (!properSubset) {
if (overlapsOrAdjoins) {
child.myRemainingRanges = child.myRemainingRanges.merge(myImplicitSrcGap);
} else if (equals) {
child.myRemainingRanges = child.myRemainingRanges.diff(myImplicitSrcGap, false);
}
}
if (revision1 > revision2) {
child.myRemainingRanges.reverse();
}
}
index++;
}
if (childrenWithMergeInfo.size() > 1) {
MergePath child = (MergePath) childrenWithMergeInfo.get(0);
if (child.myRemainingRanges.isEmpty()) {
SVNMergeRange dummyRange = new SVNMergeRange(revision2, revision2, true);
child.myRemainingRanges = new SVNMergeRangeList(dummyRange);
myIsTargetHasDummyMergeRange = true;
}
}
}