long minRev = Math.min(range.getStartRevision(), range.getEndRevision()) + 1;
long maxRev = Math.max(range.getStartRevision(), range.getEndRevision());
boolean subtractive = range.getStartRevision() > range.getEndRevision();
List mergeSources = new LinkedList();
for (int i = 0; i < segments.length; i++) {
SVNLocationSegment segment = segments[i];
if (segment.getEndRevision() < minRev || segment.getStartRevision() > maxRev ||
segment.getPath() == null) {
continue;
}
String path1 = null;
long rev1 = Math.max(segment.getStartRevision(), minRev) - 1;
if (minRev <= segment.getStartRevision()) {
if (i > 0) {
path1 = segments[i - 1].getPath();
}
if (path1 == null && i > 1) {
path1 = segments[i - 2].getPath();
rev1 = segments[i - 2].getEndRevision();
}
} else {
path1 = segment.getPath();
}
if (path1 == null || segment.getPath() == null) {
continue;
}
MergeSource mergeSource = new MergeSource();
mergeSource.myURL1 = sourceRootURL.appendPath(path1, false);
mergeSource.myURL2 = sourceRootURL.appendPath(segment.getPath(), false);
mergeSource.myRevision1 = rev1;
mergeSource.myRevision2 = Math.min(segment.getEndRevision(), maxRev);
if (subtractive) {
long tmpRev = mergeSource.myRevision1;
SVNURL tmpURL = mergeSource.myURL1;
mergeSource.myRevision1 = mergeSource.myRevision2;
mergeSource.myURL1 = mergeSource.myURL2;