本文整理汇总了C#中SemanticVersion.IncrementVersion方法的典型用法代码示例。如果您正苦于以下问题:C# SemanticVersion.IncrementVersion方法的具体用法?C# SemanticVersion.IncrementVersion怎么用?C# SemanticVersion.IncrementVersion使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SemanticVersion
的用法示例。
在下文中一共展示了SemanticVersion.IncrementVersion方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IncrementForEachCommit
private static SemanticVersion IncrementForEachCommit(GitVersionContext context, List<Commit> directCommits, SemanticVersion mainlineVersion)
{
foreach (var directCommit in directCommits)
{
var directCommitIncrement = IncrementStrategyFinder.GetIncrementForCommits(context, new[]
{
directCommit
}) ?? VersionField.Patch;
mainlineVersion = mainlineVersion.IncrementVersion(directCommitIncrement);
Logger.WriteInfo(string.Format("Direct commit on master {0} incremented base versions {1}, now {2}",
directCommit.Sha, directCommitIncrement, mainlineVersion));
}
return mainlineVersion;
}
示例2: AggregateMergeCommitIncrement
SemanticVersion AggregateMergeCommitIncrement(GitVersionContext context, Commit commit, List<Commit> directCommits, SemanticVersion mainlineVersion)
{
// Merge commit, process all merged commits as a batch
var mergeCommit = commit;
var mergedHead = GetMergedHead(mergeCommit);
var findMergeBase = context.Repository.ObjectDatabase.FindMergeBase(mergeCommit.Parents.First(), mergedHead);
var findMessageIncrement = FindMessageIncrement(context, mergeCommit, mergedHead, findMergeBase, directCommits);
// If this collection is not empty there has been some direct commits against master
// Treat each commit as it's own 'release', we need to do this before we increment the branch
mainlineVersion = IncrementForEachCommit(context, directCommits, mainlineVersion);
directCommits.Clear();
// Finally increment for the branch
mainlineVersion = mainlineVersion.IncrementVersion(findMessageIncrement);
Logger.WriteInfo(string.Format("Merge commit {0} incremented base versions {1}, now {2}",
mergeCommit.Sha, findMessageIncrement, mainlineVersion));
return mainlineVersion;
}