return null;
}
private void handleExternals(SVNAdminAreaInfo info) throws SVNException {
for (Iterator externals = info.externals(); externals.hasNext();) {
SVNExternalInfo external = (SVNExternalInfo) externals.next();
if (external.getOldURL() == null && external.getNewURL() == null) {
continue;
}
long revNumber = external.getNewRevision();
SVNRevision revision = revNumber >= 0 ? SVNRevision.create(revNumber) : getExternalRevision(external.getFile(), external.getNewURL());
setEventPathPrefix(external.getPath());
try {
if (external.getOldURL() == null) {
external.getFile().mkdirs();
dispatchEvent(SVNEventFactory.createUpdateExternalEvent(info, ""));
doCheckout(external.getNewURL(), external.getFile(), revision, revision, true);
} else if (external.getNewURL() == null) {
SVNWCAccess wcAccess = createWCAccess();
SVNAdminArea area = wcAccess.open(external.getFile(), true, SVNWCAccess.INFINITE_DEPTH);
SVNException error = null;
try {
area.removeFromRevisionControl(area.getThisDirName(), true, false);
} catch (SVNException svne) {
error = svne;
}
if (error == null || error.getErrorMessage().getErrorCode() == SVNErrorCode.WC_LEFT_LOCAL_MOD) {
try {
wcAccess.close();
} catch (SVNException svne) {
error = error == null ? svne : error;
}
}
if (error != null && error.getErrorMessage().getErrorCode() != SVNErrorCode.WC_LEFT_LOCAL_MOD) {
throw error;
}
} else {
dispatchEvent(SVNEventFactory.createUpdateExternalEvent(info, ""));
if (!external.getFile().isDirectory()) {
boolean created = external.getFile().mkdirs();
try {
doCheckout(external.getNewURL(), external.getFile(), revision, revision, true);
} catch (SVNException e) {
if (created && e.getErrorMessage().getErrorCode() == SVNErrorCode.RA_ILLEGAL_URL) {
SVNFileUtil.deleteAll(external.getFile(), true);
}
throw e;
}
} else {
File[] children = external.getFile().listFiles();
if (children != null && children.length == 0) {
// unversioned empty directory.
try {
doCheckout(external.getNewURL(), external.getFile(), revision, revision, true);
} catch (SVNException e) {
throw e;
}
continue;
}
SVNWCAccess wcAccess = createWCAccess();
SVNAdminArea area = wcAccess.open(external.getFile(), true, 0);
SVNEntry entry = area.getEntry(area.getThisDirName(), false);
wcAccess.close();
String url = entry.getURL();
if (entry != null && entry.getURL() != null) {
if (external.getNewURL().toString().equals(url)) {
doUpdate(external.getFile(), revision, true);
continue;
} else if (entry.getRepositoryRoot() != null) {
if (!SVNPathUtil.isAncestor(entry.getRepositoryRoot(), external.getNewURL().toString())) {
SVNRepository repos = createRepository(external.getNewURL(), true);
SVNURL reposRoot = repos.getRepositoryRoot(true);
try {
doRelocate(external.getFile(), entry.getSVNURL(), reposRoot, true);
} catch (SVNException svne) {
if (svne.getErrorMessage().getErrorCode() == SVNErrorCode.WC_INVALID_RELOCATION ||
svne.getErrorMessage().getErrorCode() == SVNErrorCode.CLIENT_INVALID_RELOCATION) {
deleteExternal(external);
external.getFile().mkdirs();
doCheckout(external.getNewURL(), external.getFile(), revision, revision, true);
continue;
}
throw svne;
}
}
doSwitch(external.getFile(), external.getNewURL(), revision, true);
continue;
}
}
deleteExternal(external);
external.getFile().mkdirs();
doCheckout(external.getNewURL(), external.getFile(), revision, revision, true);
}
}
} catch (SVNException th) {
if (th instanceof SVNCancelException) {
throw th;
}
getDebugLog().info(th);
File file = external.getFile();
SVNEvent event = SVNEventFactory.createSkipEvent(file, file, SVNEventAction.SKIP, SVNEventAction.UPDATE_EXTERNAL, SVNNodeKind.DIR);
event.setErrorMessage(th.getErrorMessage());
dispatchEvent(event);
} finally {
setEventPathPrefix(null);