public static byte[] getTreeConflictRawData(Map conflicts) throws SVNException {
if (conflicts == null) {
return null;
}
SVNConflictVersion nullVersion = new SVNConflictVersion(null, null, SVNRepository.INVALID_REVISION, SVNNodeKind.UNKNOWN);
SVNSkel skel = SVNSkel.createEmptyList();
for (Iterator iterator = conflicts.values().iterator(); iterator.hasNext();) {
SVNTreeConflictDescription conflict = (SVNTreeConflictDescription) iterator.next();
SVNSkel conflictSkel = SVNSkel.createEmptyList();
SVNConflictVersion sourceRightVersion = conflict.getSourceRightVersion();
sourceRightVersion = sourceRightVersion == null ? nullVersion : sourceRightVersion;
prependVersionInfo(conflictSkel, sourceRightVersion);
SVNConflictVersion sourceLeftVersion = conflict.getSourceLeftVersion();
sourceLeftVersion = sourceLeftVersion == null ? nullVersion : sourceLeftVersion;
prependVersionInfo(conflictSkel, sourceLeftVersion);
conflictSkel.addChild(SVNSkel.createAtom(conflict.getConflictReason().toString()));
conflictSkel.addChild(SVNSkel.createAtom(conflict.getConflictAction().toString()));
conflictSkel.addChild(SVNSkel.createAtom(conflict.getOperation().toString()));
if (conflict.getNodeKind() != SVNNodeKind.DIR && conflict.getNodeKind() != SVNNodeKind.FILE) {
SVNErrorMessage error = SVNErrorMessage.create(SVNErrorCode.WC_CORRUPT,
"Invalid \'node_kind\' field in tree conflict description");
SVNErrorManager.error(error, SVNLogType.WC);
}
conflictSkel.addChild(SVNSkel.createAtom(getNodeKindString(conflict.getNodeKind())));
String path = conflict.getPath().getName();
if (path.length() == 0) {
SVNErrorMessage error = SVNErrorMessage.create(SVNErrorCode.WC_CORRUPT,
"Empty path basename in tree conflict description");
SVNErrorManager.error(error, SVNLogType.WC);
}
conflictSkel.addChild(SVNSkel.createAtom(path));
conflictSkel.addChild(SVNSkel.createAtom("conflict"));
if (!isValidConflict(conflictSkel)) {
SVNErrorMessage error = SVNErrorMessage.create(SVNErrorCode.WC_CORRUPT,
"Failed to create valid conflict description skel: ''{0}''", skel.toString());
SVNErrorManager.error(error, SVNLogType.WC);