本文整理汇总了C#中SemanticVersion.OverrideVersionManuallyIfNeeded方法的典型用法代码示例。如果您正苦于以下问题:C# SemanticVersion.OverrideVersionManuallyIfNeeded方法的具体用法?C# SemanticVersion.OverrideVersionManuallyIfNeeded怎么用?C# SemanticVersion.OverrideVersionManuallyIfNeeded使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SemanticVersion
的用法示例。
在下文中一共展示了SemanticVersion.OverrideVersionManuallyIfNeeded方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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;
}
示例2: FindVersion
public SemanticVersion FindVersion(GitVersionContext context)
{
var versionOnMasterFinder = new VersionOnMasterFinder();
var tip = context.CurrentCommit;
var versionFromMaster = versionOnMasterFinder.Execute(context, tip.When());
var f = new CommitFilter
{
Since = tip,
Until = context.Repository.FindBranch("master").Tip,
SortBy = CommitSortStrategies.Topological | CommitSortStrategies.Time
};
var c = context.Repository.Commits.QueryBy(f);
var numberOfCommitsSinceRelease = c.Count();
var semanticVersion = new SemanticVersion
{
Major = versionFromMaster.Major,
Minor = versionFromMaster.Minor + 1,
Patch = 0,
PreReleaseTag = context.Configuration.DevelopBranchTag + numberOfCommitsSinceRelease,
BuildMetaData = new SemanticVersionBuildMetaData(numberOfCommitsSinceRelease, context.CurrentBranch.Name,tip.Sha,tip.When()),
};
semanticVersion.OverrideVersionManuallyIfNeeded(context.Repository, context.Configuration);
return semanticVersion;
}
示例3: FindVersion
protected SemanticVersion FindVersion(
GitVersionContext context,
BranchType branchType)
{
var ancestor = FindCommonAncestorWithDevelop(context.Repository, context.CurrentBranch, branchType);
if (!IsThereAnyCommitOnTheBranch(context.Repository, context.CurrentBranch))
{
var developVersionFinder = new DevelopVersionFinder();
return developVersionFinder.FindVersion(context);
}
var versionOnMasterFinder = new VersionOnMasterFinder();
var versionFromMaster = versionOnMasterFinder.Execute(context, context.CurrentCommit.When());
var numberOfCommitsOnBranchSinceCommit = NumberOfCommitsOnBranchSinceCommit(context, ancestor);
var preReleaseTag = context.CurrentBranch.Name
.TrimStart(branchType.ToString() + '-')
.TrimStart(branchType.ToString() + '/');
var semanticVersion = new SemanticVersion
{
Major = versionFromMaster.Major,
Minor = versionFromMaster.Minor + 1,
Patch = 0,
PreReleaseTag = preReleaseTag,
BuildMetaData = new SemanticVersionBuildMetaData(
numberOfCommitsOnBranchSinceCommit,
context.CurrentBranch.Name, context.CurrentCommit.Sha, context.CurrentCommit.When())
};
semanticVersion.OverrideVersionManuallyIfNeeded(context.Repository, context.Configuration);
return semanticVersion;
}