コード例 #1
0
 public async Task <ICEBuildDetails> GetBuildDetails(ICEPullRequest pullRequest)
 {
     return(await Task <ICEBuildDetails> .Run(() =>
     {
         return GetBuildDetails(pullRequest.Id);
     }));
 }
コード例 #2
0
 public virtual void UpdateBuilds(ICEPullRequest pullRequest)
 {
     try
     {
         //_workItemService.UpdateBuild(pullRequest);
         //Builds = pullRequest.Builds;
     }
     catch (Exception ex)
     {
         ExceptionHandler(ex);
     }
 }
コード例 #3
0
        private async Task <ICEPullRequest> GetPullRequestInternal(string repositoryName, int pullRequestNumber)
        {
            ICEPullRequest result = null;

            var pullRequest = await _service.GetPullRequest(repositoryName, pullRequestNumber);

            if (null != pullRequest)
            {
                //public bool IsReviewed { get; set; }

                result = new CEPullRequest()
                {
                    Repo         = repositoryName,
                    Sha          = pullRequest.Head.Sha,
                    Id           = pullRequest.Id,
                    Number       = pullRequest.Number,
                    Title        = pullRequest.Title,
                    Body         = pullRequest.Body,
                    Base         = pullRequest.Base.Sha,
                    Head         = pullRequest.Head.Sha,
                    BaseRef      = pullRequest.Base.Ref,
                    HeadRef      = pullRequest.Head.Ref,
                    Status       = pullRequest.State.ToString(),
                    IsLocked     = pullRequest.Locked,
                    IsMerged     = pullRequest.Merged,
                    IsMergeable  = pullRequest.Mergeable,
                    CommentCount = pullRequest.Comments,
                    CommitCount  = pullRequest.Commits,
                    UpdatedAt    = pullRequest.UpdatedAt.DateTime,
                    CreatedAt    = pullRequest.CreatedAt.DateTime,
                    Additions    = pullRequest.Additions,
                    Deletions    = pullRequest.Deletions,
                    ChangedFiles = pullRequest.ChangedFiles,
                    PatchUrl     = pullRequest.PatchUrl.AbsoluteUri,
                    DiffUrl      = pullRequest.DiffUrl.AbsoluteUri,
                    HtmlUrl      = pullRequest.HtmlUrl.AbsoluteUri,
                    Url          = pullRequest.Url.AbsolutePath,
                    IssueUrl     = pullRequest.IssueUrl.AbsoluteUri,
                    User         = pullRequest.User.Login,
                };
                if (result.IsMerged)
                {
                    result.MergedBy = pullRequest.MergedBy.Login;
                    result.MergedAt = pullRequest.MergedAt.Value.DateTime;
                }
                if (pullRequest.ClosedAt.HasValue)
                {
                    result.ClosedAt = pullRequest.ClosedAt.Value.DateTime;
                }

                if (result.CommitCount > 0)
                {
                    result.Commits = await GetPullRequestCommitsInternal(repositoryName, pullRequestNumber);
                }

                foreach (var commit in result.Commits)
                {
                    if (result.CommentCount > 0)
                    {
                        result.Comments = await GetPullRequestCommentsInternal(repositoryName, pullRequestNumber);
                    }
                }
            }

            return(result);
        }