• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# LibGit2Sharp.Commit类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



Commit类属于LibGit2Sharp命名空间,在下文中一共展示了Commit类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: CommitWrapper

        public CommitWrapper(LibGit2Sharp.Commit commit)
        {
            this.commit = commit;

            Sha = commit.Sha;
            MessageShort = commit.MessageShort;
            Message = commit.Message;
            Author = commit.Author;
            Committer = commit.Committer;
            Tree = (async (i) => commit.Tree);
            Parents = (async (i) => commit.Parents.Select((p) => new CommitWrapper(p)));
        }
开发者ID:itsananderson,项目名称:edge-git,代码行数:12,代码来源:CommitWrapper.cs


示例2: NumberOfCommitsOnBranchSinceCommit

 public int NumberOfCommitsOnBranchSinceCommit(Branch branch, Commit commit)
 {
     var olderThan = branch.Tip.Committer.When;
     return branch.Commits
         .TakeWhile(x => x != commit)
         .Count();
 }
开发者ID:reavowed,项目名称:GitReleaseNotes,代码行数:7,代码来源:GitHelper.cs


示例3: CalculateWhenMultipleParents

        static Branch[] CalculateWhenMultipleParents(IRepository repository, Commit currentCommit, ref Branch currentBranch, Branch[] excludedBranches)
        {
            var parents = currentCommit.Parents.ToArray();
            var branches = repository.Branches.Where(b => !b.IsRemote && b.Tip == parents[1]).ToList();
            if (branches.Count == 1)
            {
                var branch = branches[0];
                excludedBranches = new[]
                {
                    currentBranch,
                    branch
                };
                currentBranch = branch;
            }
            else if (branches.Count > 1)
            {
                currentBranch = branches.FirstOrDefault(b => b.Name == "master") ?? branches.First();
            }
            else
            {
                var possibleTargetBranches = repository.Branches.Where(b => !b.IsRemote && b.Tip == parents[0]).ToList();
                if (possibleTargetBranches.Count > 1)
                {
                    currentBranch = possibleTargetBranches.FirstOrDefault(b => b.Name == "master") ?? possibleTargetBranches.First();
                }
                else
                {
                    currentBranch = possibleTargetBranches.FirstOrDefault() ?? currentBranch;
                }
            }

            Logger.WriteInfo("HEAD is merge commit, this is likely a pull request using " + currentBranch.Name + " as base");

            return excludedBranches;
        }
开发者ID:mtdavidson,项目名称:GitVersion,代码行数:35,代码来源:BranchConfigurationCalculator.cs


示例4: FindVersion

        public SemanticVersion FindVersion(IRepository repository, Commit tip)
        {
            int major;
            int minor;
            int patch;
            foreach (var tag in repository.TagsByDate(tip))
            {
                if (ShortVersionParser.TryParse(tag.Name, out major, out minor, out patch))
                {
                    return BuildVersion(repository, tip, major, minor, patch);
                }
            }

            var semanticVersion = new SemanticVersion();

            string versionString;
            if (MergeMessageParser.TryParse(tip, out versionString))
            {
                if (ShortVersionParser.TryParse(versionString, out major, out minor, out patch))
                {
                    semanticVersion = BuildVersion(repository, tip, major, minor, patch);
                }
            }

            semanticVersion.OverrideVersionManuallyIfNeeded(repository);

            if (semanticVersion == null || semanticVersion.IsEmpty())
            {
                throw new WarningException("The head of a support branch should always be a merge commit if you follow gitflow. Please create one or work around this by tagging the commit with SemVer compatible Id.");
            }

            return semanticVersion;
        }
开发者ID:hbre,项目名称:GitVersion,代码行数:33,代码来源:SupportVersionFinder.cs


示例5: CommitModel

 public CommitModel(Commit commit)
 {
     Hash = commit.Id.Sha;
     Who = commit.Author.Name;
     When = commit.Author.When;
     What = commit.MessageShort;
 }
开发者ID:nulltoken,项目名称:Witinyki,代码行数:7,代码来源:CommitModel.cs


示例6: Visit

        public void Visit(Commit commit)
        {
            Dictionary<DateTime, List<CommitDetails>> commitsOnDay = null;
            if (!commitsByAuthor.TryGetValue(commit.Author.Email, out commitsOnDay))
            {
                commitsOnDay = new Dictionary<DateTime, List<CommitDetails>>();
                commitsByAuthor.Add(commit.Author.Email, commitsOnDay);
            }

            DateTime commitDate = commit.Committer.When.DateTime.Round(TimeSpan.FromDays(1));
            List<CommitDetails> commitDetails = null;
            if (!commitsOnDay.TryGetValue(commitDate, out commitDetails))
            {
                commitDetails = new List<CommitDetails>();
                commitsOnDay[commitDate] = commitDetails;
            }

            commitDetails.Add(new CommitDetails()
            {
                Id = commit.Id.Sha.Substring(0, 7),
                Author = commit.Author.Email,
                Message = commit.Message,
                CommitTime = commit.Committer.When.DateTime
            });
        }
开发者ID:ZanyGnu,项目名称:GitRepoStats,代码行数:25,代码来源:CommitsByAuthorAnalyzer.cs


示例7: GetBranchConfiguration

        public static KeyValuePair<string, BranchConfig> GetBranchConfiguration(Commit currentCommit, IRepository repository, bool onlyEvaluateTrackedBranches, Config config, Branch currentBranch, IList<Branch> excludedInheritBranches = null)
        {
            var matchingBranches = LookupBranchConfiguration(config, currentBranch);

            if (matchingBranches.Length == 0)
            {
                var branchConfig = new BranchConfig();
                ConfigurationProvider.ApplyBranchDefaults(config, branchConfig);
                return new KeyValuePair<string, BranchConfig>(string.Empty, branchConfig);
            }
            if (matchingBranches.Length == 1)
            {
                var keyValuePair = matchingBranches[0];
                var branchConfiguration = keyValuePair.Value;

                if (branchConfiguration.Increment == IncrementStrategy.Inherit)
                {
                    return InheritBranchConfiguration(onlyEvaluateTrackedBranches, repository, currentCommit, currentBranch, keyValuePair, branchConfiguration, config, excludedInheritBranches);
                }

                return keyValuePair;
            }

            const string format = "Multiple branch configurations match the current branch branchName of '{0}'. Matching configurations: '{1}'";
            throw new Exception(string.Format(format, currentBranch.Name, string.Join(", ", matchingBranches.Select(b => b.Key))));
        }
开发者ID:pierrebakker,项目名称:GitVersion,代码行数:26,代码来源:BranchConfigurationCalculator.cs


示例8: GetIntermediateCommits

        private static IEnumerable<Commit> GetIntermediateCommits(IRepository repo, Commit baseCommit, Commit headCommit)
        {
            if (baseCommit == null) yield break;

            if (intermediateCommitCache == null || intermediateCommitCache.LastOrDefault() != headCommit)
            {
                var filter = new CommitFilter
                {
                    Since = headCommit,
                    SortBy = CommitSortStrategies.Topological | CommitSortStrategies.Reverse
                };

                intermediateCommitCache = repo.Commits.QueryBy(filter).ToList();
            }

            var found = false;
            foreach (var commit in intermediateCommitCache)
            {
                if (commit.Sha == baseCommit.Sha)
                    found = true;

                if (found)
                    yield return commit;
            }
        }
开发者ID:pierrebakker,项目名称:GitVersion,代码行数:25,代码来源:IncrementStrategyFinder.cs


示例9: TagCommit

 public TagCommit( Commit c, ReleaseTagVersion first )
 {
     Debug.Assert( c != null && first != null && first.IsValid );
     _commitSha = c.Sha;
     _contentSha = c.Tree.Sha;
     _thisTag = first;
 }
开发者ID:gep13,项目名称:SGV-Net,代码行数:7,代码来源:TagCommit.cs


示例10: Archive

 /// <summary>
 /// Create a TAR archive of the given commit.
 /// </summary>
 /// <param name="odb">The object database.</param>
 /// <param name="commit">commit.</param>
 /// <param name="archivePath">The archive path.</param>
 public static void Archive(this ObjectDatabase odb, Commit commit, string archivePath)
 {
     using (var output = new FileStream(archivePath, FileMode.Create))
     using (var archiver = new TarArchiver(output))
     {
         odb.Archive(commit, archiver);
     }
 }
开发者ID:Bacem,项目名称:libgit2sharp,代码行数:14,代码来源:ObjectDatabaseExtensions.cs


示例11: BaseVersion

 public BaseVersion(string source, bool shouldIncrement, SemanticVersion semanticVersion, Commit baseVersionSource, string branchNameOverride)
 {
     Source = source;
     ShouldIncrement = shouldIncrement;
     SemanticVersion = semanticVersion;
     BaseVersionSource = baseVersionSource;
     BranchNameOverride = branchNameOverride;
 }
开发者ID:Wikell,项目名称:GitVersion,代码行数:8,代码来源:BaseVersion.cs


示例12: FromCommit

        public static GraphEntry FromCommit(GraphEntry previous, Commit commit)
        {
            if (previous == null) {
                return CreateFirstEntry(commit);
            }

            return CreateEntryFromCommit(previous, commit);
        }
开发者ID:offbeat-solutions,项目名称:offgit,代码行数:8,代码来源:GraphEntry.cs


示例13: GitCommit

 internal GitCommit(Commit commit)
 {
     Sha = commit.Sha;
     Author = new GitSignature(commit.Author.Email, commit.Author.Name, commit.Author.When);
     Committer = new GitSignature(commit.Committer.Email, commit.Committer.Name, commit.Committer.When);
     Message = commit.Message;
     MessageShort = commit.MessageShort;
 }
开发者ID:Redth,项目名称:Cake_Git,代码行数:8,代码来源:GitCommit.cs


示例14: ContainsUser

 private bool ContainsUser(Commit commit)
 {
     if (!string.IsNullOrEmpty(user))
        {
        return commit.Committer.Name.Equals(user);
        }
        return true;
 }
开发者ID:nielsschroyen,项目名称:GitHistory,代码行数:8,代码来源:CommitFilterBuilder.cs


示例15: BisectStep

 public BisectStep(Commit c, int result)
 {
     commit = c;
     if (-1 <= result && result <= 1)
         i = result;
     else
         i = Result.NOTSET;
 }
开发者ID:reisi007,项目名称:Bibi-GUI,代码行数:8,代码来源:BisectStep.cs


示例16: ContainsComment

 private bool ContainsComment(Commit commit)
 {
     if (!string.IsNullOrEmpty(comment))
        {
        return commit.Message.ToLower().Contains(comment.ToLower()) || commit.MessageShort.ToLower().Contains(comment.ToLower()); ;
        }
        return true;
 }
开发者ID:nielsschroyen,项目名称:GitHistory,代码行数:8,代码来源:CommitFilterBuilder.cs


示例17: BeforeDate

 private bool BeforeDate(Commit commit)
 {
     if (to != null)
        {
        return commit.Committer.When.Date <= to;
        }
        return true;
 }
开发者ID:nielsschroyen,项目名称:GitHistory,代码行数:8,代码来源:CommitFilterBuilder.cs


示例18: AfterDate

 private bool AfterDate(Commit commit)
 {
     if (from != null)
        {
        return commit.Committer.When.Date >= from;
        }
        return true;
 }
开发者ID:nielsschroyen,项目名称:GitHistory,代码行数:8,代码来源:CommitFilterBuilder.cs


示例19: GitDiffDirectory

 public GitDiffDirectory(Commit commit)
 {
   var files = new List<IDiffFile>();
   GitMergeOperation.WalkTree(commit.Tree, (path, blob) =>
   {
     files.Add(new GitDiffFile(blob) { Path = path });
   });
   _files = files;
 }
开发者ID:rneuber1,项目名称:InnovatorAdmin,代码行数:9,代码来源:GitDiffDirectory.cs


示例20: HighlightCommit

        private bool HighlightCommit(Commit commit)
        {
            CommitVertex commitVertex = GetCommitVertex(commit);
            if (commitVertex.OnCurrentBranch)
                return false;

            commitVertex.OnCurrentBranch = true;
            return true;
        }
开发者ID:tecnovaldehierro,项目名称:SeeGit,代码行数:9,代码来源:RepositoryGraphBuilder.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# LibGit2Sharp.Repository类代码示例发布时间:2022-05-26
下一篇:
C# LibGeo.GeoCoord类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap