private void copyVersionedDir(File from, File to, SVNRevision revision, String eolStyle, boolean force, SVNDepth depth) throws SVNException {
SVNWCAccess wcAccess = createWCAccess();
SVNAdminArea adminArea = wcAccess.probeOpen(from, false, 0);
SVNEntry entry = null;
try {
entry = wcAccess.getVersionedEntry(from, false);
} catch (SVNException svne) {
wcAccess.close();
throw svne;
}
if (revision == SVNRevision.WORKING && entry.isScheduledForDeletion()) {
return;
}
if (revision != SVNRevision.WORKING && entry.isScheduledForAddition()) {
return;
}
if (entry.isDirectory()) {
// create dir
boolean dirCreated = to.mkdirs();
if (!to.exists() || to.isFile()) {
SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.IO_ERROR, "Cannot create directory ''{0}''", to);
SVNErrorManager.error(err, SVNLogType.WC);
}
if (!dirCreated && to.isDirectory() && !force) {
SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.WC_OBSTRUCTED_UPDATE, "''{0}'' already exists and will not be owerwritten unless forced", to);
SVNErrorManager.error(err, SVNLogType.WC);
}
// read entries
for (Iterator ents = adminArea.entries(false); ents.hasNext();) {
SVNEntry childEntry = (SVNEntry) ents.next();
if (childEntry.isDirectory()) {
if (adminArea.getThisDirName().equals(childEntry.getName())) {
continue;
} else if (depth == SVNDepth.INFINITY) {
File childTo = new File(to, childEntry.getName());
File childFrom = new File(from, childEntry.getName());
copyVersionedDir(childFrom, childTo, revision, eolStyle, force, depth);
}
} else if (childEntry.isFile()) {
File childTo = new File(to, childEntry.getName());
copyVersionedFile(childTo, adminArea, childEntry.getName(), revision, eolStyle);
}
}
if (!isIgnoreExternals() && depth == SVNDepth.INFINITY && entry.getDepth() == SVNDepth.INFINITY) {
SVNVersionedProperties properties = adminArea.getProperties(adminArea.getThisDirName());
String externalsValue = properties.getStringPropertyValue(SVNProperty.EXTERNALS);