mustDumpProps = FSRepositoryUtil.arePropertiesChanged(compareRoot, comparePath, myRoot,
canonicalPath);
if (kind == SVNNodeKind.FILE) {
mustDumpText = FSRepositoryUtil.areFileContentsChanged(compareRoot, comparePath,
myRoot, canonicalPath);
FSRevisionNode revNode = compareRoot.getRevisionNode(comparePath);
String checkSum = revNode.getFileMD5Checksum();
if (checkSum != null && checkSum.length() > 0) {
writeDumpData(SVNAdminHelper.DUMPFILE_TEXT_COPY_SOURCE_MD5 + ": " + checkSum + "\n");
}
checkSum = revNode.getFileSHA1Checksum();
if (checkSum != null && checkSum.length() > 0) {
writeDumpData(SVNAdminHelper.DUMPFILE_TEXT_COPY_SOURCE_SHA1 + ": " + checkSum + "\n");
}
}
}
break;
}
if (!mustDumpProps && !mustDumpText) {
writeDumpData("\n\n");
return;
}
long contentLength = 0;
String propContents = null;
if (mustDumpProps) {
FSRevisionNode node = myRoot.getRevisionNode(canonicalPath);
SVNProperties props = node.getProperties(myFSFS);
SVNProperties oldProps = null;
if (myUseDeltas && compareRoot != null) {
FSRevisionNode cmpNode = myRoot.getRevisionNode(comparePath);
oldProps = cmpNode.getProperties(myFSFS);
writeDumpData(SVNAdminHelper.DUMPFILE_PROP_DELTA + ": true\n");
}
ByteArrayOutputStream encodedProps = new ByteArrayOutputStream();
SVNAdminHelper.writeProperties(props, oldProps, encodedProps);
propContents = new String(encodedProps.toByteArray(), "UTF-8");
contentLength += propContents.length();
writeDumpData(SVNAdminHelper.DUMPFILE_PROP_CONTENT_LENGTH + ": " + propContents.length() + "\n");
}
File tmpFile = null;
if (mustDumpText && kind == SVNNodeKind.FILE) {
long txtLength = 0;
FSRevisionNode node = myRoot.getRevisionNode(canonicalPath);
if (myUseDeltas) {
tmpFile = SVNFileUtil.createTempFile("dump", ".tmp");
tmpFile.deleteOnExit();
InputStream sourceStream = null;
InputStream targetStream = null;
OutputStream tmpStream = null;
SVNDeltaCombiner deltaCombiner = getDeltaCombiner();
SVNDeltaGenerator deltaGenerator = getDeltaGenerator();
try {
if (compareRoot != null && comparePath != null) {
sourceStream = compareRoot.getFileStreamForPath(deltaCombiner, comparePath);
} else {
sourceStream = SVNFileUtil.DUMMY_IN;
}
targetStream = myRoot.getFileStreamForPath(deltaCombiner, canonicalPath);
tmpStream = SVNFileUtil.openFileForWriting(tmpFile);
final CountingOutputStream countingStream = new CountingOutputStream(tmpStream, 0);
ISVNDeltaConsumer consumer = new ISVNDeltaConsumer() {
private boolean isHeaderWritten = false;
public OutputStream textDeltaChunk(String path, SVNDiffWindow diffWindow) throws SVNException {
try {
if (diffWindow != null) {
diffWindow.writeTo(countingStream, !isHeaderWritten, false);
} else {
SVNDiffWindow.EMPTY.writeTo(countingStream, !isHeaderWritten, false);
}
} catch (IOException ioe) {
SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.IO_ERROR, ioe.getLocalizedMessage());
SVNErrorManager.error(err, ioe, SVNLogType.FSFS);
}
isHeaderWritten = true;
return SVNFileUtil.DUMMY_OUT;
}
public void applyTextDelta(String path, String baseChecksum) throws SVNException {
}
public void textDeltaEnd(String path) throws SVNException {
}
};
deltaGenerator.sendDelta(null, sourceStream, 0, targetStream, consumer, false);
txtLength = countingStream.getPosition();
if (compareRoot != null) {
FSRevisionNode revNode = compareRoot.getRevisionNode(comparePath);
String hexDigest = revNode.getFileMD5Checksum();
if (hexDigest != null && hexDigest.length() > 0) {
writeDumpData(SVNAdminHelper.DUMPFILE_TEXT_DELTA_BASE_MD5 + ": " + hexDigest + "\n");
}
hexDigest = revNode.getFileSHA1Checksum();
if (hexDigest != null && hexDigest.length() > 0) {
writeDumpData(SVNAdminHelper.DUMPFILE_TEXT_DELTA_BASE_SHA1 + ": " + hexDigest + "\n");
}
}
} finally {