String srcURL = pair.myOriginalSource;
SVNURL url = SVNURL.parseURIEncoded(srcURL);
SVNUpdateClient updateClient = new SVNUpdateClient(getRepositoryPool(), getOptions());
updateClient.setEventHandler(getEventDispatcher());
File dstFile = new Resource(pair.myDst);
SVNRevision srcRevision = pair.mySourceRevision;
SVNRevision srcPegRevision = pair.mySourcePegRevision;
updateClient.doCheckout(url, dstFile, srcPegRevision, srcRevision, SVNDepth.INFINITY, false);
if (sameRepositories) {
url = SVNURL.parseURIEncoded(pair.mySource);
SVNAdminArea dstArea = dstAccess.open(dstFile, true, SVNWCAccess.INFINITE_DEPTH);
SVNEntry dstRootEntry = dstArea.getEntry(dstArea.getThisDirName(), false);
if (srcRevision == SVNRevision.HEAD) {
srcRevNum = dstRootEntry.getRevision();
}
SVNAdminArea dir = dstAccess.getAdminArea(dstFile.getParentFile());
SVNWCManager.add(dstFile, dir, url, srcRevNum, SVNDepth.INFINITY);
Map srcMergeInfo = calculateTargetMergeInfo(null, null, url, srcRevNum, topSrcRepos, false);
extendWCMergeInfo(dstFile, dstRootEntry, srcMergeInfo, dstAccess);
} else {
SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.UNSUPPORTED_FEATURE, "Source URL ''{0}'' is from foreign repository; leaving it as a disjoint WC", url);
SVNErrorManager.error(err, SVNLogType.WC);
}
} else if (pair.mySourceKind == SVNNodeKind.FILE) {
String srcURL = pair.mySource;
SVNURL url = SVNURL.parseURIEncoded(srcURL);
File dst = new Resource(pair.myDst);
SVNAdminArea dir = dstAccess.getAdminArea(dst.getParentFile());
File tmpFile = SVNAdminUtil.createTmpFile(dir);
String path = getPathRelativeToRoot(null, url, null, null, topSrcRepos);
SVNProperties props = new SVNProperties();
OutputStream os = null;
long revision = -1;
try {
os = SVNFileUtil.openFileForWriting(tmpFile);
revision = topSrcRepos.getFile(path, srcRevNum, props, new SVNCancellableOutputStream(os, this));
} finally {
SVNFileUtil.closeFile(os);
}
if (srcRevNum < 0) {
srcRevNum = revision;
}
SVNWCManager.addRepositoryFile(dir, dst.getName(), null, tmpFile, props, null,
sameRepositories ? pair.mySource : null,
sameRepositories ? srcRevNum : -1);
SVNEntry entry = dstAccess.getEntry(dst, false);
Map mergeInfo = calculateTargetMergeInfo(null, null, url, srcRevNum, topSrcRepos, false);