当前位置: 首页>>代码示例>>C#>>正文


C# Repository.ResolveMergeBaseCommit方法代码示例

本文整理汇总了C#中LibGit2Sharp.Repository.ResolveMergeBaseCommit方法的典型用法代码示例。如果您正苦于以下问题:C# Repository.ResolveMergeBaseCommit方法的具体用法?C# Repository.ResolveMergeBaseCommit怎么用?C# Repository.ResolveMergeBaseCommit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在LibGit2Sharp.Repository的用法示例。


在下文中一共展示了Repository.ResolveMergeBaseCommit方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Main

        private static void Main(string[] args)
        {
            try
            {
                var commitIds = ParseCommitIds(args);

                using (var repo = new Repository("."))
                {
                    var mergeBaseCommit = repo.ResolveMergeBaseCommit(commitIds);

                    Console.WriteLine("Using " + mergeBaseCommit + " as merge base.");

                    var patch = repo.Diff.Compare<Patch>(mergeBaseCommit.Tree, repo.Head.Tip.Tree);
                    var valid = patch.Where(HasValidChangeStatus).ToList();
                    var specs = valid.Where(IsSpec).ToList();
                    var testable = valid.Where(IsTestable).ToList();

                    var testableClassesMissingSpecFiles = testable.Where(testablePatchEntryChange => GetPossibleSpecs(testablePatchEntryChange, specs).Count < 1).ToList();

                    var testableClassesPossiblyMissingSpecs = testable.Where(testablePatchEntryChange => !testableClassesMissingSpecFiles.Contains(testablePatchEntryChange) && !IsTested(testablePatchEntryChange, GetPossibleSpecs(testablePatchEntryChange, specs)));

                    Console.WriteLine();
                    Console.WriteLine("All changes");
                    patch.ForEach(patchEntryChanges => Console.WriteLine(patchEntryChanges.Status + " -> " + patchEntryChanges.Path));

                    Console.WriteLine();
                    Console.WriteLine("Changes with valid change status of " + string.Join(", ", ValidChangeStatuses.ToList().ConvertAll(validChangeStatus => validChangeStatus.ToString())));
                    valid.ForEach(patchEntryChanges => Console.WriteLine(patchEntryChanges.Status + " -> " + patchEntryChanges.Path));

                    Console.WriteLine();
                    Console.WriteLine("testable class changes");
                    testable.ForEach(patchEntryChanges => Console.WriteLine(patchEntryChanges.Status + " -> " + patchEntryChanges.Path));

                    Console.WriteLine();
                    Console.WriteLine("specs found");
                    specs.ForEach(patchEntryChanges => Console.WriteLine(patchEntryChanges.Status + " -> " + patchEntryChanges.Path));

                    Console.WriteLine();
                    Console.WriteLine("testable classes with missing specs");
                    testableClassesMissingSpecFiles.ForEach(patchEntryChanges => Console.WriteLine(patchEntryChanges.Status + " -> " + patchEntryChanges.Path));

                    Console.WriteLine();
                    Console.WriteLine("testable classes with possibly missing specs");
                    testableClassesPossiblyMissingSpecs.ForEach(patchEntryChanges => Console.WriteLine(patchEntryChanges.Status + " -> " + patchEntryChanges.Path));
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }
        }
开发者ID:sflanagan180251,项目名称:IsItSpec,代码行数:51,代码来源:Program.cs


注:本文中的LibGit2Sharp.Repository.ResolveMergeBaseCommit方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。