if (makeParents) {
CopyPair pair = (CopyPair) copyPairs.get(0);
if (!pair.myDst.equals(rootURL)) {
oldLocation = nonTopRepos.getLocation();
nonTopRepos.setLocation(SVNURL.parseURIEncoded(pair.myDst).removePathTail(), false);
SVNNodeKind kind = nonTopRepos.checkPath("", -1);
while (kind == SVNNodeKind.NONE) {
newDirs.add(nonTopRepos.getLocation().toString());
nonTopRepos.setLocation(nonTopRepos.getLocation().removePathTail(), false);
kind = nonTopRepos.checkPath("", -1);
}
}
} else if (Boolean.getBoolean("svnkit.compatibleHash")) {
// XXX: hack for tests to generate error message tests will like.
// do not check paths above repository root.
CopyPair pair = (CopyPair) copyPairs.get(0);
if (!pair.myDst.equals(rootURL)) {
oldLocation = nonTopRepos.getLocation();
nonTopRepos.setLocation(SVNURL.parseURIEncoded(pair.myDst).removePathTail(), false);
SVNNodeKind kind = nonTopRepos.checkPath("", -1);
if (kind == SVNNodeKind.NONE) {
SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.FS_NOT_FOUND, "''{0}'' path not found", nonTopRepos.getLocation());
SVNErrorManager.error(err, SVNLogType.WC);
}
}
}
if (oldLocation != null) {
nonTopRepos.setLocation(oldLocation, false);
}
/*
* Check if source is dst child (while dst is not root).
*/
for (int i = 0; i < copyPairs.size(); i++) {
CopyPair pair = (CopyPair) copyPairs.get(i);
CopyPathInfo info = (CopyPathInfo) pathInfos.get(i);
if (!pair.myDst.equals(rootURL) && SVNPathUtil.getPathAsChild(pair.myDst, pair.mySource) != null) {
info.isResurrection = true;
}
}
long latestRevision = nonTopRepos.getLatestRevision();
for (int i = 0; i < copyPairs.size(); i++) {
CopyPair pair = (CopyPair) copyPairs.get(i);
CopyPathInfo info = (CopyPathInfo) pathInfos.get(i);
pair.mySourceRevisionNumber = getRevisionNumber(pair.mySourceRevision, nonTopRepos, null);
info.mySourceRevisionNumber = pair.mySourceRevisionNumber;
SVNRepositoryLocation[] locations = getLocations(SVNURL.parseURIEncoded(pair.mySource), null, null /*optimize topRepos*/, pair.mySourcePegRevision, pair.mySourceRevision, SVNRevision.UNDEFINED);
pair.mySource = locations[0].getURL().toString();
// tests:
// src is equal to dst
if (isMove && pair.mySource.equals(pair.myDst)) {
//if ("".equals(srcRelative) && isMove) {
SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.UNSUPPORTED_FEATURE, "Cannot move URL ''{0}'' into itself", SVNURL.parseURIEncoded(pair.mySource));
SVNErrorManager.error(err, SVNLogType.WC);
}
// src doesn't exist at source revision.
nonTopRepos.setLocation(SVNURL.parseURIEncoded(pair.mySource), false);
info.mySourceKind = nonTopRepos.checkPath("", pair.mySourceRevisionNumber);
if (info.mySourceKind == SVNNodeKind.NONE) {
SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.FS_NOT_FOUND,
"Path ''{0}'' does not exist in revision {1}", new Object[] {SVNURL.parseURIEncoded(pair.mySource), new Long(pair.mySourceRevisionNumber)});
SVNErrorManager.error(err, SVNLogType.WC);
}
// dst already exists at HEAD.
nonTopRepos.setLocation(SVNURL.parseURIEncoded(pair.myDst), false);
SVNNodeKind dstKind = nonTopRepos.checkPath("", latestRevision);
if (dstKind != SVNNodeKind.NONE) {
SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.FS_ALREADY_EXISTS,
"Path ''{0}'' already exists", pair.myDst);
SVNErrorManager.error(err, SVNLogType.WC);
}