public void Append(RevisionId revisionId, PathPair path, FileHistoryEntry historyEntry) { string fileId; if (historyEntry.FileId != Guid.Empty) { fileId = historyEntry.FileId.ToString(); } else { fileId = "PROV_" + Convert.ToBase64String(Encoding.UTF8.GetBytes($"{path.OldPath}\0{path.NewPath}")); } var matrixEntry = Find(x => x.FileId == fileId); if (matrixEntry == null) { matrixEntry = new Entry(_revisions) { FileId = fileId }; Add(matrixEntry); } matrixEntry.Revisions[revisionId] = Status.From(path, historyEntry); }
public static Status From(PathPair path, FileHistoryEntry historyEntry) => new Status { File = path, IsNew = historyEntry.IsNew, IsRenamed = historyEntry.IsRenamed, IsDeleted = historyEntry.IsDeleted, IsUnchanged = !historyEntry.IsModified, };