boolean[] isTreeConflict = { false };
Map targetMergeInfo;
Map implicitMergeInfo;
SVNURL sourceRootURL = null;
String mergeInfoPath = null;
SVNMergeRange conflictedRange = null;
myWCAccess.probeTry(targetWCPath, true, SVNWCAccess.INFINITE_DEPTH);
SVNEntry entry = myWCAccess.getVersionedEntry(targetWCPath, false);
if (honorMergeInfo) {
sourceRootURL = myRepository1.getRepositoryRoot(true);
mergeInfoPath = getPathRelativeToRoot(null, primaryURL, sourceRootURL, null, null);
}
SVNMergeRange range = new SVNMergeRange(revision1, revision2, true);
Object[] mergeInfoBundle = calculateRemainingRangeList(targetWCPath, entry, sourceRootURL, indirect,
url1, revision1, url2, revision2, range);
SVNMergeRangeList remainingRangeList = (SVNMergeRangeList) mergeInfoBundle[0];
targetMergeInfo = (Map) mergeInfoBundle[1];
implicitMergeInfo = (Map) mergeInfoBundle[1];
SVNMergeRange[] remainingRanges = remainingRangeList.getRanges();
AbstractDiffCallback callback = getMergeCallback(adminArea);
String targetName = targetWCPath.getName();
if (!myIsRecordOnly) {
SVNMergeRangeList rangeListToMerge = remainingRangeList;
if (myAreSourcesAncestral && remainingRangeList.getSize() > 1) {
SVNURL oldSessionURL = ensureSessionURL(myRepository1, primaryURL);
rangeListToMerge = removeNoOpMergeRanges(myRepository1, remainingRangeList);
if (oldSessionURL != null) {
myRepository1.setLocation(oldSessionURL, false);
}
}
SVNMergeRange[] rangesToMerge = rangeListToMerge.getRanges();
for (int i = 0; i < rangesToMerge.length; i++) {
SVNMergeRange nextRange = rangesToMerge[i];
boolean headerSent = false;
SVNEvent event = SVNEventFactory.createSVNEvent(targetWCPath, SVNNodeKind.UNKNOWN, null,
SVNRepository.INVALID_REVISION, myIsSameRepository ? SVNEventAction.MERGE_BEGIN : SVNEventAction.FOREIGN_MERGE_BEGIN, null, null,
myAreSourcesAncestral ? nextRange : null);
SVNProperties props1 = new SVNProperties();
SVNProperties props2 = new SVNProperties();
File f1 = null;
File f2 = null;
String mimeType2;
String mimeType1;
SVNStatusType[] mergeResult;
SVNRepository repos1 = myRepository1;
SVNRepository repos2 = myRepository2;
if (honorMergeInfo && !url1.equals(url2)) {
if (!isRollBack && nextRange.getStartRevision() != revision1) {
repos1 = repos2;
} else if (isRollBack && nextRange.getEndRevision() != revision2) {
repos2 = repos1;
}
}
try {
f1 = loadFile(repos1, nextRange.getStartRevision(), props1, adminArea);
f2 = loadFile(repos2, nextRange.getEndRevision(), props2, adminArea);
mimeType1 = props1.getStringValue(SVNProperty.MIME_TYPE);
mimeType2 = props2.getStringValue(SVNProperty.MIME_TYPE);
props1 = filterProperties(props1, true, false, false);
props2 = filterProperties(props2, true, false, false);
SVNProperties propsDiff = computePropsDiff(props1, props2);
if (!(myIsIgnoreAncestry || sourcesRelated)) {
SVNStatusType cstatus = callback.fileDeleted(targetName, f1, f2, mimeType1,
mimeType2, props1, isTreeConflict);
headerSent = notifySingleFileMerge(targetWCPath, isTreeConflict[0] ? SVNEventAction.TREE_CONFLICT :
SVNEventAction.UPDATE_DELETE, cstatus, SVNStatusType.UNKNOWN, event, headerSent);
mergeResult = callback.fileAdded(targetName, f1, f2, nextRange.getStartRevision(),
nextRange.getEndRevision(), mimeType1, mimeType2,
props1, propsDiff, isTreeConflict);
headerSent = notifySingleFileMerge(targetWCPath, isTreeConflict[0] ? SVNEventAction.TREE_CONFLICT :
SVNEventAction.UPDATE_ADD, mergeResult[0], mergeResult[1], event, headerSent);
} else {
mergeResult = callback.fileChanged(targetName, f1, f2, nextRange.getStartRevision(),
nextRange.getEndRevision(), mimeType1,
mimeType2, props1, propsDiff, isTreeConflict);
headerSent = notifySingleFileMerge(targetWCPath, isTreeConflict[0] ? SVNEventAction.TREE_CONFLICT :
SVNEventAction.UPDATE_UPDATE, mergeResult[0], mergeResult[1], event, headerSent);
}
} finally {