Пример #1
0
        void ISessionAdapter.Save(FileHistoryEntry entry)
        {
            if (entry.RevisionId.HasValue)
            {
                Assert.That(entry.RevisionId.Value, Is.AnyOf(Revisions.Select(x => (object)x.Id).ToArray()), "File history entry must be linked to valid revision");
            }

            var revision = Revisions.SingleOrDefault(x => x.Id == entry.RevisionId) ?? EmptyRevision;

            if (FileHistory.TryGetValue(revision, out var l))
            {
                if (!l.Contains(entry))
                {
                    l.Add(entry);
                }
            }
            else
            {
                FileHistory[revision] = new List <FileHistoryEntry>()
                {
                    entry
                };
            }
        }
Пример #2
0
 async Task <ReviewRevision> ISessionAdapter.GetRevision(ReviewIdentifier reviewId, PublishReview.RevisionCommits commits)
 {
     return(Revisions.SingleOrDefault(x => x.BaseCommit == commits.Base && x.HeadCommit == commits.Head));
 }