Ejemplo n.º 1
0
        PullRequestView GetNewPullRequestView(Octokit.Issue request)
        {
            var repositoryName = request.PullRequest.HtmlUrl.Segments[2].TrimEnd('/');
            var newRequest     = new PullRequestView()
            {
                RepoName   = repositoryName,
                Title      = request.Title,
                Id         = request.Number,
                Created    = request.CreatedAt,
                Updated    = request.UpdatedAt.GetValueOrDefault(),
                State      = request.State,
                Developer  = request.User.Login,
                JiraIssues = GetJiraIssues(request, repositoryName), //TODO: Get Commits, Comments, etc?
                Tag        = request
            };

            return(newRequest);
        }
Ejemplo n.º 2
0
        async Task <PullRequestView> UpdateCommits(Octokit.Issue request, PullRequestView pullRequest, string sha)
        {
            var commitTask = await Client.Repository.Commit.Get(_owner, pullRequest.RepoName, sha);

            if (null != commitTask)
            {
                pullRequest.Commits.Add(commitTask);

                pullRequest.HasDbUpgrade         = commitTask.Files.Any(f => f.Filename.Contains("AdvUpgrade"));
                pullRequest.HasBuildScriptChange = commitTask.Files.Any(f => f.Filename.Contains("build.ps1"));

                pullRequest.Files = commitTask.Files.Select(f => f.Filename).ToList();

                var advantagePatchBuilder = new PullRequestAssembyHelper(pullRequest, "rroberts");
                pullRequest.AssembliesChanged = advantagePatchBuilder.AssemblyFiles;
            }

            return(pullRequest);
        }
Ejemplo n.º 3
0
        async Task <PullRequestView> GetPullRequestDetails(Octokit.Issue request, PullRequestView pullRequest)
        {
            var pullRequestDetails = await Client.Repository.PullRequest.Get(_owner, pullRequest.RepoName, pullRequest.Id);

            pullRequest.Branch     = pullRequestDetails.Base.Ref;
            pullRequest.RepoBranch = BranchVersionHelper.Map.GetRepoBranch(pullRequest.Branch);
            if (null != pullRequest.RepoBranch)
            {
                pullRequest.Version = pullRequest.RepoBranch.Version;
            }
            pullRequest.Mergeable        = pullRequestDetails.Mergeable;
            pullRequest.Merged           = pullRequestDetails.Merged;
            pullRequest.ChangedFileCount = pullRequestDetails.ChangedFiles;
            pullRequest.State            = pullRequestDetails.State;
            pullRequest.CommitCount      = pullRequestDetails.Commits;
            pullRequest.JiraIssues       = GetJiraIssues(request, pullRequest.RepoName);

            pullRequest = await UpdateCommits(request, pullRequest, pullRequestDetails.Head.Sha);

            return(pullRequest);
        }