Exemplo n.º 1
0
        public static IEnumerable <Method> GetInvolvedMethodInFile(this Commit commit,
                                                                   PatchEntryChanges changes,
                                                                   Func <Hunk, IEnumerable <Line> > linesStrategy)
        {
            var methods = new List <Method>();

            var fileContent = commit.GetFileContent(changes.Path);

            if (fileContent == null)
            {
                return(methods);
            }

            foreach (var chunk in changes.Hunks)
            {
                methods.AddRange(linesStrategy(chunk)
                                 .Select(line => fileContent.GetMethodFromLineAndFile(changes.Path, line)));
            }

            return(methods.Distinct());
        }