SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.CLIENT_BAD_REVISION,
"Not all required revisions are specified");
SVNErrorManager.error(err, SVNLogType.DEFAULT);
}
SVNRepository repository1 = null;
SVNRepository repository2 = null;
myWCAccess = createWCAccess();
targetWCPath = targetWCPath.getAbsoluteFile();
try {
SVNAdminArea adminArea = myWCAccess.probeOpen(targetWCPath, !dryRun, SVNWCAccess.INFINITE_DEPTH);
SVNEntry entry = myWCAccess.getVersionedEntry(targetWCPath, false);
SVNURL wcReposRoot = getReposRoot(targetWCPath, null, SVNRevision.WORKING, adminArea, myWCAccess);
long[] latestRev = new long[1];
latestRev[0] = SVNRepository.INVALID_REVISION;
repository1 = createRepository(url1, null, null, false);
SVNURL sourceReposRoot = repository1.getRepositoryRoot(true);
long rev1 = getRevisionNumber(revision1, latestRev, repository1, null);
repository2 = createRepository(url2, null, null, false);
long rev2 = getRevisionNumber(revision2, latestRev, repository2, null);
boolean sameRepos = sourceReposRoot.equals(wcReposRoot);
String youngestCommonPath = null;
long youngestCommonRevision = SVNRepository.INVALID_REVISION;
if (!ignoreAncestry) {
SVNLocationEntry youngestLocation = getYoungestCommonAncestor(null, url1, rev1, null, url2,
rev2);
youngestCommonPath = youngestLocation.getPath();
youngestCommonRevision = youngestLocation.getRevision();
}
boolean related = false;
boolean ancestral = false;
List mergeSources = null;
if (youngestCommonPath != null && SVNRevision.isValidRevisionNumber(youngestCommonRevision)) {
SVNRevisionRange range = null;
List ranges = new LinkedList();
related = true;
SVNURL youngestCommonURL = sourceReposRoot.appendPath(youngestCommonPath, false);
if (youngestCommonURL.equals(url2) && youngestCommonRevision == rev2) {
ancestral = true;
SVNRevision sRev = SVNRevision.create(rev1);
SVNRevision eRev = SVNRevision.create(youngestCommonRevision);
range = new SVNRevisionRange(sRev, eRev);
ranges.add(range);
mergeSources = normalizeMergeSources(null, url1, sourceReposRoot, sRev,
ranges, repository1);
} else if (youngestCommonURL.equals(url1) && youngestCommonRevision == rev1) {
ancestral = true;
SVNRevision sRev = SVNRevision.create(youngestCommonRevision);
SVNRevision eRev = SVNRevision.create(rev2);
range = new SVNRevisionRange(sRev, eRev);
ranges.add(range);
mergeSources = normalizeMergeSources(null, url2, sourceReposRoot, eRev,
ranges, repository2);
} else {
mergeCousinsAndSupplementMergeInfo(targetWCPath, entry, adminArea, repository1, url1,
rev1, url2, rev2, youngestCommonRevision, sourceReposRoot, wcReposRoot, depth,
ignoreAncestry, force, recordOnly, dryRun);
return;
}
} else {
MergeSource mergeSrc = new MergeSource();
mergeSrc.myURL1 = url1;
mergeSrc.myURL2 = url2;
mergeSrc.myRevision1 = rev1;
mergeSrc.myRevision2 = rev2;
mergeSources = new LinkedList();
mergeSources.add(mergeSrc);
}
repository1.closeSession();
repository2.closeSession();
doMerge(mergeSources, targetWCPath, entry, adminArea, ancestral, related, sameRepos,
ignoreAncestry, force, dryRun, recordOnly, depth);
} finally {
if (repository1 != null) {
repository1.closeSession();
}
if (repository2 != null) {
repository2.closeSession();
}
try {
myWCAccess.close();
} catch (SVNException svne) {
//