}
private void dump(FSFS fsfs, OutputStream dumpStream, long start, long end, boolean isIncremental, boolean useDeltas) throws SVNException {
boolean isDumping = dumpStream != null && dumpStream != SVNFileUtil.DUMMY_OUT;
long youngestRevision = fsfs.getYoungestRevision();
SVNAdminDeltifier deltifier = new SVNAdminDeltifier(fsfs, SVNDepth.INFINITY,
false, false, false, null);
if (!SVNRevision.isValidRevisionNumber(start)) {
start = 0;
}
if (!SVNRevision.isValidRevisionNumber(end)) {
end = youngestRevision;
}
if (dumpStream == null) {
dumpStream = SVNFileUtil.DUMMY_OUT;
}
if (start > end) {
SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.REPOS_BAD_ARGS,
"Start revision {0} is greater than end revision {1}", new Object[] { String.valueOf(start),
String.valueOf(end) });
SVNErrorManager.error(err, SVNLogType.FSFS);
}
if (end > youngestRevision) {
SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.REPOS_BAD_ARGS,
"End revision {0} is invalid (youngest revision is {1})", new Object[] { String.valueOf(end),
String.valueOf(youngestRevision) });
SVNErrorManager.error(err, SVNLogType.FSFS);
}
if (start == 0 && isIncremental) {
isIncremental = false;
}
String uuid = fsfs.getUUID();
int version = SVNAdminHelper.DUMPFILE_FORMAT_VERSION;
if (!useDeltas) {
//for compatibility with SVN 1.0.x
version--;
}
writeDumpData(dumpStream, SVNAdminHelper.DUMPFILE_MAGIC_HEADER + ": " + version + "\n\n");
writeDumpData(dumpStream, SVNAdminHelper.DUMPFILE_UUID + ": " + uuid + "\n\n");
for (long i = start; i <= end; i++) {
long fromRev, toRev;
checkCancelled();
if (i == start && !isIncremental) {
if (i == 0) {
writeRevisionRecord(dumpStream, fsfs, 0);
toRev = 0;
String message = (isDumping ? "* Dumped" : "* Verified") + " revision " + toRev + ".";
if (myEventHandler != null) {
SVNAdminEvent event = new SVNAdminEvent(toRev, SVNAdminEventAction.REVISION_DUMPED, message);
myEventHandler.handleAdminEvent(event, ISVNEventHandler.UNKNOWN);
}
continue;
}
fromRev = 0;
toRev = i;
} else {
fromRev = i - 1;
toRev = i;
}
writeRevisionRecord(dumpStream, fsfs, toRev);
boolean useDeltasForRevision = useDeltas && (isIncremental || i != start);
FSRevisionRoot toRoot = fsfs.createRevisionRoot(toRev);
ISVNEditor dumpEditor = getDumpEditor(fsfs, toRoot, toRev, start, "/", dumpStream, useDeltasForRevision, false);
if (i == start && !isIncremental) {
FSRevisionRoot fromRoot = fsfs.createRevisionRoot(fromRev);
deltifier.setEditor(dumpEditor);
deltifier.deltifyDir(fromRoot, "/", "", toRoot, "/");
} else {
FSRepositoryUtil.replay(fsfs, toRoot, "", -1, false, dumpEditor);
}
String message = (isDumping ? "* Dumped" : "* Verified") + " revision " + toRev + ".";
if (myEventHandler != null) {