Exemplo n.º 1
0
        private void AssertConflictDetection(string fileName, RavenJObject localMetadata, RavenJObject sourceMetadata, ServerInfo sourceServer, out bool isConflictResolved)
        {
            var conflict = ConflictDetector.Check(fileName, localMetadata, sourceMetadata, sourceServer.FileSystemUrl);

            isConflictResolved = ConflictResolver.IsResolved(localMetadata, conflict);

            if (conflict != null && !isConflictResolved)
            {
                ConflictArtifactManager.Create(fileName, conflict);

                Publisher.Publish(new ConflictNotification
                {
                    FileName         = fileName,
                    SourceServerUrl  = sourceServer.FileSystemUrl,
                    Status           = ConflictStatus.Detected,
                    RemoteFileHeader = new FileHeader(fileName, localMetadata)
                });

                Log.Debug(
                    "File '{0}' is in conflict with synchronized version from {1} ({2}). File marked as conflicted, conflict configuration item created",
                    fileName, sourceServer.FileSystemUrl, sourceServer.Id);

                throw new SynchronizationException(string.Format("File {0} is conflicted", fileName));
            }
        }
Exemplo n.º 2
0
        protected ConflictItem CheckConflictWithDestination(RavenJObject sourceMetadata,
                                                            RavenJObject destinationMetadata, string localServerUrl)
        {
            var conflict           = conflictDetector.CheckOnSource(FileName, sourceMetadata, destinationMetadata, localServerUrl);
            var isConflictResolved = conflictResolver.IsResolved(destinationMetadata, conflict);

            // optimization - conflict checking on source side before any changes pushed
            if (conflict != null && !isConflictResolved)
            {
                return(conflict);
            }

            return(null);
        }