protected async Task<SynchronizationReport> ApplyConflictOnDestinationAsync(ConflictItem conflict, string destination,
string localServerUrl, Logger log)
{
log.Debug("File '{0}' is in conflict with destination version from {1}. Applying conflict on destination", FileName,
destination);
var destinationRavenFileSystemClient = new RavenFileSystemClient(destination);
try
{
var version = conflict.RemoteHistory.Last().Version;
var serverId = conflict.RemoteHistory.Last().ServerId;
var history = new List<HistoryItem>(conflict.RemoteHistory);
history.RemoveAt(conflict.RemoteHistory.Count - 1);
await
destinationRavenFileSystemClient.Synchronization.ApplyConflictAsync(FileName, version, serverId, history,
localServerUrl);
}
catch (Exception ex)
{
log.WarnException(string.Format("Failed to apply conflict on {0} for file '{1}'", destination, FileName), ex);
}
return new SynchronizationReport(FileName, FileETag, SynchronizationType)
{
Exception = new SynchronizationException(string.Format("File {0} is conflicted", FileName)),
};
}