byte[] conflictStart = ("<<<<<<< " + localLabel).getBytes();
byte[] conflictEnd = (">>>>>>> " + latestLabel).getBytes();
byte[] separator = ("=======").getBytes();
ISVNMergerFactory factory = myWCAccess.getOptions().getMergerFactory();
ISVNMerger merger = factory.createMerger(conflictStart, separator, conflictEnd);
boolean customMerger = merger.getClass() != DefaultSVNMerger.class;
if (SVNProperty.isBinaryMimeType(mimeType) && !customMerger) {
// binary
if (!dryRun) {
File oldFile = SVNFileUtil.createUniqueFile(getRoot(), localPath, baseLabel);
File newFile = SVNFileUtil.createUniqueFile(getRoot(), localPath, latestLabel);
SVNFileUtil.copyFile(base, oldFile, false);
SVNFileUtil.copyFile(latest, newFile, false);
// update entry props
entry.setConflictNew(SVNFileUtil.getBasePath(newFile));
entry.setConflictOld(SVNFileUtil.getBasePath(oldFile));
entry.setConflictWorking(null);
saveEntries(false);
}
status = SVNStatusType.CONFLICTED;
} else {
// text
// 1. destranslate local
File localTmpFile = SVNFileUtil.createUniqueFile(getRoot(), localPath, ".tmp");
SVNTranslator.translate(this, localPath, localPath, SVNFileUtil.getBasePath(localTmpFile), false);
// 2. run merge between all files we have :)
OutputStream result = null;
File resultFile = dryRun ? null : SVNFileUtil.createUniqueFile(getRoot(), localPath, ".result");
result = resultFile == null ? SVNFileUtil.DUMMY_OUT : SVNFileUtil.openFileForWriting(resultFile);
try {
status = SVNProperty.isBinaryMimeType(mimeType) ?
merger.mergeBinary(base, localTmpFile, latest, dryRun, result) :
merger.mergeText(base, localTmpFile, latest, dryRun, options, result);
} finally {
SVNFileUtil.closeFile(result);
}
if (dryRun) {
localTmpFile.delete();