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


C# SemanticVersion.OverrideVersionManuallyIfNeeded方法代码示例

本文整理汇总了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;
        }
开发者ID:hbre,项目名称:GitVersion,代码行数:33,代码来源:SupportVersionFinder.cs

示例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;
        }
开发者ID:unic,项目名称:GitVersion,代码行数:29,代码来源:DevelopVersionFinder.cs

示例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;
        }
开发者ID:unic,项目名称:GitVersion,代码行数:34,代码来源:DevelopBasedVersionFinderBase.cs


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