SVNErrorManager.error(err, SVNLogType.WC);
}
}
if (adminArea != null) {
SVNEntry entry = adminArea.getEntry(adminArea.getThisDirName(), false);
if (entry != null && entry.isScheduledForAddition() && !entry.isCopied()) {
myCurrentDirectory.isAddExisted = true;
} else {
SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.WC_OBSTRUCTED_UPDATE,
"Failed to add directory ''{0}'': a versioned directory of the same name already exists",
myCurrentDirectory.getPath());
SVNErrorManager.error(err, SVNLogType.WC);
}
}
}
if (SVNFileUtil.getAdminDirectoryName().equals(name)) {
SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.WC_OBSTRUCTED_UPDATE,
"Failed to add directory ''{0}'': object of the same name as the administrative directory",
path);
SVNErrorManager.error(err, SVNLogType.WC);
}
if (copyFromPath != null || SVNRevision.isValidRevisionNumber(copyFromRevision)) {
SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.UNSUPPORTED_FEATURE,
"Failed to add directory ''{0}'': copyfrom arguments not yet supported", path);
SVNErrorManager.error(err, SVNLogType.WC);
}
SVNEntry entry = parentArea.getEntry(name, false);
Map attributes = new SVNHashMap();
attributes.put(SVNProperty.KIND, SVNProperty.KIND_DIR);
attributes.put(SVNProperty.ABSENT, null);
attributes.put(SVNProperty.DELETED, null);
boolean force = false;
if (myCurrentDirectory.isAddExisted) {
attributes.put(SVNProperty.SCHEDULE, null);
force = true;
}
entry = parentArea.modifyEntry(name, attributes, true, force);
if (myCurrentDirectory.isAddExisted) {
attributes.put(SVNProperty.REVISION, Long.toString(myTargetRevision));
if (mySwitchURL != null) {
attributes.put(SVNProperty.URL, SVNPathUtil.append(mySwitchURL, name));
}
SVNAdminArea adminArea = myCurrentDirectory.getAdminArea();
adminArea.modifyEntry(adminArea.getThisDirName(), attributes, true, true);
}
String rootURL = null;
if (SVNPathUtil.isAncestor(myRootURL, myCurrentDirectory.URL)) {
rootURL = myRootURL;
}
if (myWCAccess.getAdminArea(childDir) != null) {
myWCAccess.closeAdminArea(childDir);
}
if (SVNWCManager.ensureAdminAreaExists(childDir, myCurrentDirectory.URL, rootURL, null,
myTargetRevision, myCurrentDirectory.myAmbientDepth)) {
// hack : remove created lock file.
SVNFileUtil.deleteFile(new File(childDir, SVNFileUtil.getAdminDirectoryName() + "/lock"));
}
SVNAdminArea childArea = myWCAccess.open(childDir, true, 0);
myWCAccess.registerCleanupHandler(childArea, myCurrentDirectory);
if (!myCurrentDirectory.isAddExisted) {
SVNEvent event = SVNEventFactory.createSVNEvent(parentArea.getFile(entry.getName()),
SVNNodeKind.DIR, null, myTargetRevision, myCurrentDirectory.isExisted ?
SVNEventAction.UPDATE_EXISTS : SVNEventAction.UPDATE_ADD, null, null, null);
event.setPreviousRevision(myCurrentDirectory.myPreviousRevision);
event.setPreviousURL(entry.getSVNURL());
event.setURL(myCurrentDirectory.URL != null ? SVNURL.parseURIEncoded(myCurrentDirectory.URL) : null);
myWCAccess.handleEvent(event);
}
}