Ejemplo n.º 1
0
        private static bool ReadFileChanges(IEnumerator <string> lines, CommitFileChanges commitFileChanges)
        {
            while (lines.MoveNext())
            {
                if (lines.Current.Length == 0)
                {
                    return(false);
                }

                Match fileChangeMatch = fileChangeRegex.Match(lines.Current);
                if (!fileChangeMatch.Success)
                {
                    string message = string.Format("Expected file change but found: {0}", lines.Current);
                    throw new GitCommandFailedException(message, commitFileChanges);
                }

                FileCommit fileCommit = new FileCommit()
                {
                    ChangeType = GetFileChangeType(fileChangeMatch.Groups["ChangeType"].Value[0]),
                    Name       = fileChangeMatch.Groups["Name"].Value,
                    Commit     = commitFileChanges.Commit
                };
                commitFileChanges.FileCommits.Add(fileCommit);
            }

            return(true);
        }
Ejemplo n.º 2
0
        private Task <IEnumerable <AbstractSyntaxNode> > FindChangesAsync(FileCommit commit)
        {
            SolutionWithSyntax oldText = GetOldText(commit);
            SolutionWithSyntax newText = GetNewText(commit);

            sourceTextByFileName[commit.Name] = newText;
            return(ChangeFinder.FindChangesForSingleDocumentSolutionAsync(oldText, newText));
        }
Ejemplo n.º 3
0
        private void AddFileCommit(AbstractSyntaxNode member, FileCommit fileCommit)
        {
            string documentationId;

            if (documentationIds.TryGetValue(member.ToString(), out documentationId))
            {
                FileCommits fileCommits;
                if (!fileCommitsByMember.TryGetValue(documentationId, out fileCommits))
                {
                    fileCommits = new FileCommits();
                    fileCommitsByMember.Add(documentationId, fileCommits);
                }

                fileCommits.Add(fileCommit);
            }
        }
 public MemberListBuilder(FileCommit fileCommit, Action<AbstractSyntaxNode, FileCommit> buildAction)
 {
     this.fileCommit = fileCommit;
     this.buildAction = buildAction;
 }
Ejemplo n.º 5
0
        private SolutionWithSyntax GetNewText(FileCommit commit)
        {
            string text = repository.FindFileAtRevision(commit.Name, commit.Commit.CommitId);

            return(SolutionWithSyntax.CreateSolutionForText(text));
        }
Ejemplo n.º 6
0
 private SolutionWithSyntax GetOldText(FileCommit commit)
 {
     return(sourceTextByFileName[commit.Name]);
 }
Ejemplo n.º 7
0
 public MemberListBuilder(FileCommit fileCommit, Action <AbstractSyntaxNode, FileCommit> buildAction)
 {
     this.fileCommit  = fileCommit;
     this.buildAction = buildAction;
 }
        private static bool ReadFileChanges(IEnumerator<string> lines, CommitFileChanges commitFileChanges)
        {
            while (lines.MoveNext())
            {
                if (lines.Current.Length == 0)
                {
                    return false;
                }

                Match fileChangeMatch = fileChangeRegex.Match(lines.Current);
                if (!fileChangeMatch.Success)
                {
                    string message = string.Format("Expected file change but found: {0}", lines.Current);
                    throw new GitCommandFailedException(message, commitFileChanges);
                }

                FileCommit fileCommit = new FileCommit()
                {
                    ChangeType = GetFileChangeType(fileChangeMatch.Groups["ChangeType"].Value[0]),
                    Name = fileChangeMatch.Groups["Name"].Value,
                    Commit = commitFileChanges.Commit
                };
                commitFileChanges.FileCommits.Add(fileCommit);
            }

            return true;
        }
 private SolutionWithSyntax GetNewText(FileCommit commit)
 {
     string text = repository.FindFileAtRevision(commit.Name, commit.Commit.CommitId);
     return SolutionWithSyntax.CreateSolutionForText(text);
 }
 private SolutionWithSyntax GetOldText(FileCommit commit)
 {
     return sourceTextByFileName[commit.Name];
 }
 private Task<IEnumerable<AbstractSyntaxNode>> FindChangesAsync(FileCommit commit)
 {
     SolutionWithSyntax oldText = GetOldText(commit);
     SolutionWithSyntax newText = GetNewText(commit);
     sourceTextByFileName[commit.Name] = newText;
     return ChangeFinder.FindChangesForSingleDocumentSolutionAsync(oldText, newText);
 }
        private void AddFileCommit(AbstractSyntaxNode member, FileCommit fileCommit)
        {
            string documentationId;
            if (documentationIds.TryGetValue(member.ToString(), out documentationId))
            {
                FileCommits fileCommits;
                if (!fileCommitsByMember.TryGetValue(documentationId, out fileCommits))
                {
                    fileCommits = new FileCommits();
                    fileCommitsByMember.Add(documentationId, fileCommits);
                }

                fileCommits.Add(fileCommit);
            }
        }