Example #1
0
 public PullRequestCacheItem(PullRequest pr, IReadOnlyList<PullRequestFile> files)
 {
     Title = pr.Title;
     Number = pr.Number;
     Base = new GitReferenceCacheItem
     {
         Label = pr.Base.Label,
         Ref = pr.Base.Ref,
         Sha = pr.Base.Sha,
         RepositoryCloneUrl = pr.Base.Repository.CloneUrl,
     };
     Head = new GitReferenceCacheItem
     {
         Label = pr.Head.Label,
         Ref = pr.Head.Ref,
         Sha = pr.Head.Sha,
         RepositoryCloneUrl = pr.Head.Repository?.CloneUrl
     };
     CommentCount = pr.Comments + pr.ReviewComments;
     CommitCount = pr.Commits;
     Author = new AccountCacheItem(pr.User);
     Assignee = pr.Assignee != null ? new AccountCacheItem(pr.Assignee) : null;
     CreatedAt = pr.CreatedAt;
     UpdatedAt = pr.UpdatedAt;
     Body = pr.Body;
     ChangedFiles = files.Select(x => new PullRequestFileCacheItem(x)).ToList();
     State = GetState(pr);
     IsOpen = pr.State == ItemState.Open;
     Merged = pr.Merged;
     Key = Number.ToString(CultureInfo.InvariantCulture);
     Timestamp = UpdatedAt;
 }
 GitReferenceModel Create(GitReferenceCacheItem item)
 {
     return(new GitReferenceModel(item.Ref, item.Label, item.Sha, item.RepositoryCloneUrl));
 }
Example #3
0
 GitReferenceModel Create(GitReferenceCacheItem item)
 {
     return new GitReferenceModel(item.Ref, item.Label, item.Sha, item.RepositoryCloneUrl);
 }
Example #4
0
 private GitReferenceModel Create(GitReferenceCacheItem item)
 {
     return(item != null ? new GitReferenceModel(item.Ref, item.Label, item.RepositoryCloneUrl) : null);
 }