comparePath = cmpPath;
compareRevision = cmpRev;
}
comparePath = SVNPathUtil.canonicalizeAbsPath(comparePath);
FSRevisionRoot compareRoot = null;
boolean mustDumpProps = false;
boolean mustDumpText = false;
String canonicalPath = SVNPathUtil.canonicalizeAbsPath(path);
switch(nodeAction) {
case SVNAdminHelper.NODE_ACTION_CHANGE:
writeDumpData(SVNAdminHelper.DUMPFILE_NODE_ACTION + ": change\n");
compareRoot = myFSFS.createRevisionRoot(compareRevision);
mustDumpProps = FSRepositoryUtil.arePropertiesChanged(compareRoot, comparePath, myRoot, canonicalPath);
if (kind == SVNNodeKind.FILE) {
mustDumpText = FSRepositoryUtil.areFileContentsChanged(compareRoot, comparePath, myRoot, canonicalPath);
}
break;
case SVNAdminHelper.NODE_ACTION_REPLACE:
if (!isCopy) {
writeDumpData(SVNAdminHelper.DUMPFILE_NODE_ACTION + ": replace\n");
if (kind == SVNNodeKind.FILE) {
mustDumpText = true;
}
mustDumpProps = true;
} else {
writeDumpData(SVNAdminHelper.DUMPFILE_NODE_ACTION + ": delete\n\n");
dumpNode(path, kind, SVNAdminHelper.NODE_ACTION_ADD, isCopy, comparePath, compareRevision);
mustDumpText = false;
mustDumpProps = false;
}
break;
case SVNAdminHelper.NODE_ACTION_DELETE:
writeDumpData(SVNAdminHelper.DUMPFILE_NODE_ACTION + ": delete\n");
mustDumpText = false;
mustDumpProps = false;
break;
case SVNAdminHelper.NODE_ACTION_ADD:
writeDumpData(SVNAdminHelper.DUMPFILE_NODE_ACTION + ": add\n");
if (!isCopy) {
if (kind == SVNNodeKind.FILE) {
mustDumpText = true;
}
mustDumpProps = true;
} else {
if (cmpRev < myOldestDumpedRevision) {
SVNDebugLog.getDefaultLog().info("WARNING: Referencing data in revision " + cmpRev + ", which is older than the oldest\nWARNING: dumped revision (" + myOldestDumpedRevision + "). Loading this dump into an empty repository\nWARNING: will fail.\n");
}
writeDumpData(SVNAdminHelper.DUMPFILE_NODE_COPYFROM_REVISION + ": " + cmpRev + "\n");
writeDumpData(SVNAdminHelper.DUMPFILE_NODE_COPYFROM_PATH + ": " + cmpPath + "\n");
compareRoot = myFSFS.createRevisionRoot(compareRevision);
mustDumpProps = FSRepositoryUtil.arePropertiesChanged(compareRoot, comparePath, myRoot, canonicalPath);
if (kind == SVNNodeKind.FILE) {
mustDumpText = FSRepositoryUtil.areFileContentsChanged(compareRoot, comparePath, myRoot, canonicalPath);
}
}
break;
}
if (!mustDumpProps && !mustDumpText) {
writeDumpData("\n\n");
return;
}
long contentLength = 0;
String propContents = null;
if (mustDumpProps) {
FSRevisionNode node = myRoot.getRevisionNode(canonicalPath);
Map props = node.getProperties(myFSFS);
Map 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);