}
}
Collection ignores = useGlobalIgnores ? SVNStatusEditor.getGlobalIgnores(getOptions()) : null;
checkCancelled();
boolean changed = false;
SVNCommitInfo info = null;
try {
commitEditor.openRoot(-1);
String newDirPath = null;
for (int i = newPaths.size() - 1; i >= 0; i--) {
newDirPath = newDirPath == null ? (String) newPaths.get(i) : SVNPathUtil.append(newDirPath, (String) newPaths.get(i));
commitEditor.addDir(newDirPath, null, -1);
}
changed = newPaths.size() > 0;
SVNDeltaGenerator deltaGenerator = new SVNDeltaGenerator();
if (srcKind == SVNFileType.DIRECTORY) {
changed |= importDir(deltaGenerator, path, newDirPath, useGlobalIgnores,
ignoreUnknownNodeTypes, depth, commitEditor);
} else if (srcKind == SVNFileType.FILE || srcKind == SVNFileType.SYMLINK) {
if (!useGlobalIgnores || !SVNStatusEditor.isIgnored(ignores, path, "/" + path.getName())) {
changed |= importFile(deltaGenerator, path, srcKind, filePath, commitEditor);
}
} else if (srcKind == SVNFileType.NONE || srcKind == SVNFileType.UNKNOWN) {
SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.NODE_UNKNOWN_KIND,
"''{0}'' does not exist", path);
SVNErrorManager.error(err, SVNLogType.WC);
}
if (!changed) {
try {
commitEditor.abortEdit();
} catch (SVNException e) {}
return SVNCommitInfo.NULL;
}
for (int i = 0; i < newPaths.size(); i++) {
commitEditor.closeDir();
}
info = commitEditor.closeEdit();
} finally {
if (!changed || info == null) {
try {
commitEditor.abortEdit();
} catch (SVNException e) {
//
}
}
}
if (info != null && info.getNewRevision() >= 0) {
dispatchEvent(SVNEventFactory.createSVNEvent(null, SVNNodeKind.NONE, null, info.getNewRevision(),
SVNEventAction.COMMIT_COMPLETED, null, null, null), ISVNEventHandler.UNKNOWN);
}
return info != null ? info : SVNCommitInfo.NULL;
}