if (makeParents) {
CopyPair pair = (CopyPair) copyPairs.get(0);
String relativeDir = SVNPathUtil.getPathAsChild(topURL, SVNPathUtil.removeTail(pair.myDst));
if (relativeDir != null) {
relativeDir = SVNEncodingUtil.uriDecode(relativeDir);
SVNNodeKind kind = topRepos.checkPath(relativeDir, -1);
while(kind == SVNNodeKind.NONE) {
newDirs.add(relativeDir);
relativeDir = SVNPathUtil.removeTail(relativeDir);
kind = topRepos.checkPath(relativeDir, -1);
}
}
}
String rootURL = topRepos.getRepositoryRoot(true).toString();
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;
// TODO still looks like a bug.
// if (SVNPathUtil.removeTail(pair.myDst).equals(topURL)) {
topURL = SVNPathUtil.removeTail(topURL);
// }
}
}
topRepos.setLocation(SVNURL.parseURIEncoded(topURL), false);
long latestRevision = topRepos.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, topRepos, null);
info.mySourceRevisionNumber = pair.mySourceRevisionNumber;
SVNRepositoryLocation[] locations = getLocations(SVNURL.parseURIEncoded(pair.mySource), null, topRepos, pair.mySourcePegRevision, pair.mySourceRevision, SVNRevision.UNDEFINED);
pair.mySource = locations[0].getURL().toString();
String srcRelative = SVNPathUtil.getPathAsChild(topURL, pair.mySource);
if (srcRelative != null) {
srcRelative = SVNEncodingUtil.uriDecode(srcRelative);
} else {
srcRelative = "";
}
String dstRelative = SVNPathUtil.getPathAsChild(topURL, pair.myDst);
if (dstRelative != null) {
dstRelative = SVNEncodingUtil.uriDecode(dstRelative);
} else {
dstRelative = "";
}
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);
}
info.mySourceKind = topRepos.checkPath(srcRelative, 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);
}
SVNNodeKind dstKind = topRepos.checkPath(dstRelative, latestRevision);
if (dstKind != SVNNodeKind.NONE) {
SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.FS_ALREADY_EXISTS,
"Path ''{0}'' already exists", dstRelative);
SVNErrorManager.error(err, SVNLogType.WC);
}