internal static IEnumerable <ObjectRepositoryPropertyChange> ComputeChanges_Modified(IObjectRepository objectRepository, IObjectRepositorySerializer serializer, PatchEntryChanges change, Func <string, Blob> relativeFileDataResolverStart, Func <string, Blob> relativeFileDataResolverEnd) { // Get data file path, in the case where a blob has changed var dataPath = change.Path.GetSiblingFile(FileSystemStorage.DataFile); var currentObject = objectRepository.TryGetFromGitPath(dataPath) ?? throw new NotImplementedException($"Conflict as a modified node {change.Path} has been deleted in current rebase state."); var changeStart = serializer.Deserialize( relativeFileDataResolverStart(FileSystemStorage.DataFile)?.GetContentStream() ?? throw new GitObjectDbException("Change start content could not be found."), relativePath => relativeFileDataResolverStart(relativePath)?.GetContentText() ?? string.Empty); var changeEnd = serializer.Deserialize( relativeFileDataResolverEnd(FileSystemStorage.DataFile)?.GetContentStream() ?? throw new GitObjectDbException("Change end content could not be found."), relativePath => relativeFileDataResolverEnd(relativePath)?.GetContentText() ?? string.Empty); var changes = ObjectRepositoryMerge.ComputeModifiedProperties(change, changeStart, changeEnd, currentObject); // Indexes will be recomputed anyways from the changes when committed, // so there is no need to track them in the modified chunks var changesWithoutIndexes = changes.Where( modifiedProperty => !typeof(IObjectRepositoryIndex).IsAssignableFrom(modifiedProperty.Property.Property.ReflectedType)); return(changesWithoutIndexes); }
internal MergeProcessor(ObjectRepositoryMerge objectRepositoryMerge, ComputeTreeChangesFactory computeTreeChangesFactory, GitHooks hooks) { _merge = objectRepositoryMerge ?? throw new ArgumentNullException(nameof(objectRepositoryMerge)); _computeTreeChangesFactory = computeTreeChangesFactory ?? throw new ArgumentNullException(nameof(computeTreeChangesFactory)); _hooks = hooks ?? throw new ArgumentNullException(nameof(hooks)); }