private void applyChangesAndPersistDatabase(MemoryDatabase winnersDatabase, boolean cleanupOccurred,
List<PartialFileHistory> preDeleteFileHistoriesWithLastVersion) throws Exception {
if (options.isApplyChanges()) {
new ApplyChangesOperation(config, localDatabase, transferManager, winnersDatabase, result, cleanupOccurred,
preDeleteFileHistoriesWithLastVersion).execute();
}
else {
logger.log(Level.INFO, "Doing nothing on the file system, because --no-apply switched on");
}
DatabaseBranch currentApplyBranch = new DatabaseBranch();
for (DatabaseVersion databaseVersion : winnersDatabase.getDatabaseVersions()) {
currentApplyBranch.add(databaseVersion.getHeader());
}
persistDatabaseVersions(currentApplyBranch, winnersDatabase);
localDatabase.commit();
}