Example #1
0
        private IEnumerable <DiffFile> ParseDiffByFiles()
        {
            var matches   = Parse($@"(?<=diff --git a\/)([\w|\W]*?)(?= b\/) b\/\1\n[\w|\W]*?(\@\@[\w|\W]*?)\n(?=diff --git a\/|$)");
            var length    = matches.Count;
            var diffFiles = new DiffFile[length];

            for (int i = 0; i < length; i++)
            {
                var groups = matches[i].Groups;
                diffFiles[i] = new DiffFile
                {
                    Name      = groups[1].Value,
                    DiffLines = DiffLineParser.GetDiffLines(groups[2].Value, groups[1].Value)
                };
            }
            return(diffFiles);
        }
Example #2
0
 public static ReviewComment ToReviewComment(this Octokit.PullRequestReviewComment comment)
 {
     return(new ReviewComment
     {
         Id = comment.Id,
         ReplyToId = comment.InReplyToId,
         Content = comment.Body,
         DiffHunk = DiffLineParser.GetDiffLines(comment.DiffHunk, comment.Path),
         Owner = new User
         {
             Login = comment.User.Login,
             Url = comment.User.HtmlUrl
         },
         Path = comment.Path,
         Position = comment.Position,
         ReviewId = comment.PullRequestReviewId
     });
 }