if (!honorMergeInfo || myIsRecordOnly) {
for (ListIterator childrenIter = childrenWithMergeInfo.listIterator(); childrenIter.hasNext();) {
MergePath child = (MergePath) childrenIter.next();
SVNMergeRange range = new SVNMergeRange(revision1, revision2, inheritable);
child.myRemainingRanges = new SVNMergeRangeList(range);
}
return;
}
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) {
long[] rangePoints = SVNMergeInfoUtil.getRangeEndPoints(child.myImplicitMergeInfo);
long youngestRev = rangePoints[0];
long oldestRev = rangePoints[1];
for (Iterator mergeInfoIter = child.myImplicitMergeInfo.keySet().iterator(); mergeInfoIter.hasNext();) {
String sourcePath = (String) mergeInfoIter.next();
SVNMergeRangeList sourceRangeList = (SVNMergeRangeList) child.myImplicitMergeInfo.get(sourcePath);
SVNMergeRange[] srcRanges = sourceRangeList.getRanges();
SVNMergeRange range = srcRanges[srcRanges.length - 1];
youngestRev = range.getEndRevision();
SVNMergeRangeList rev1rev2RangeList = new SVNMergeRangeList(new SVNMergeRange(oldestRev, youngestRev, true));
SVNMergeRangeList result = sourceRangeList.merge(rev1rev2RangeList);
sourceRangeList.setRanges(result.getRanges());
}
}
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,
index > 0, childEntry, repository);
index++;
}
if (childrenWithMergeInfo.size() > 1) {
MergePath child = (MergePath) childrenWithMergeInfo.get(0);
if (child.myRemainingRanges.isEmpty()) {
SVNMergeRange dummyRange = new SVNMergeRange(revision2, revision2, inheritable);
child.myRemainingRanges = new SVNMergeRangeList(dummyRange);
myIsTargetHasDummyMergeRange = true;
}
}
}