final SVNLogEntry[] currentRevision = new SVNLogEntry[1];
long count = toRevision - fromRevision + 1;
if (dstLatestRevision == 0) {
SVNProperties zeroRevisionProperties = src.getRevisionProperties(0, null);
updateRevisionProperties(dst, 0, zeroRevisionProperties);
}
for (long i = fromRevision; i <= toRevision; i++) {
SVNProperties revisionProps = src.getRevisionProperties(i, null);
String commitMessage = revisionProps.getStringValue(SVNRevisionProperty.LOG);
currentRevision[0] = null;
checkCancelled();
src.log(new String[]{""}, i, i, true, false, 1, new ISVNLogEntryHandler() {
public void handleLogEntry(SVNLogEntry logEntry) throws SVNException {
currentRevision[0] = logEntry;
}
});
checkCancelled();
if (currentRevision[0] == null || currentRevision[0].getChangedPaths() == null) {
SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.UNKNOWN, "Revision ''{0}'' does not contain information on changed paths; probably access is denied", new Long(i));
SVNErrorManager.error(err, SVNLogType.FSFS);
} else if (currentRevision[0].getDate() == null) {
SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.UNKNOWN, "Revision ''{0}'' does not contain commit date; probably access is denied", new Long(i));
SVNErrorManager.error(err, SVNLogType.FSFS);
}
fireReplicatingEvent(currentRevision[0]);
commitMessage = commitMessage == null ? "" : commitMessage;
ISVNEditor commitEditor = SVNCancellableEditor.newInstance(dst.getCommitEditor(commitMessage, null), this, src.getDebugLog());
SVNReplicationEditor bridgeEditor = null;
try {
bridgeEditor = new SVNReplicationEditor(src, commitEditor, currentRevision[0]);
final long previousRev = i - 1;
src.update(i, null, true, new ISVNReporterBaton() {
public void report(ISVNReporter reporter) throws SVNException {
reporter.setPath("", null, previousRev, SVNDepth.INFINITY, false);
reporter.finishReport();
}
}, SVNCancellableEditor.newInstance(bridgeEditor, this, src.getDebugLog()));
} catch (SVNException svne) {
try {
bridgeEditor.abortEdit();
} catch (SVNException e) {
}
throw svne;
} catch (Throwable th) {
try {
bridgeEditor.abortEdit();
} catch (SVNException e) {
}
SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.UNKNOWN, th.getMessage());
SVNErrorManager.error(err, th, SVNLogType.FSFS);
}
SVNCommitInfo commitInfo = bridgeEditor.getCommitInfo();
try {
updateRevisionProperties(dst, i, revisionProps);
String author = revisionProps.getStringValue(SVNRevisionProperty.AUTHOR);
Date date = SVNDate.parseDate(revisionProps.getStringValue(SVNRevisionProperty.DATE));
commitInfo = new SVNCommitInfo(i, author, date);
} catch (SVNException e) {
// skip revprop set failures.
}
fireReplicatedEvent(commitInfo);