diff --git a/GitVersionCore.Tests/ConfigProviderTests.cs b/GitVersionCore.Tests/ConfigProviderTests.cs index 8ad0f47011..9677f28a31 100644 --- a/GitVersionCore.Tests/ConfigProviderTests.cs +++ b/GitVersionCore.Tests/ConfigProviderTests.cs @@ -1,3 +1,4 @@ +using System; using System.IO; using System.Linq; using System.Reflection; @@ -26,28 +27,59 @@ public void CanReadDocument() { const string text = @" assembly-versioning-scheme: MajorMinor -develop-branch-tag: alpha -release-branch-tag: rc next-version: 2.0.0 tag-prefix: '[vV|version-]' +mode: ContinuousDelivery +branches: + develop: + mode: ContinuousDeployment + tag: dev + release[/-]: + mode: ContinuousDeployment + tag: rc "; SetupConfigFileContent(text); var config = ConfigurationProvider.Provide(gitDirectory, fileSystem); config.AssemblyVersioningScheme.ShouldBe(AssemblyVersioningScheme.MajorMinor); - config.DevelopBranchTag.ShouldBe("alpha"); - config.ReleaseBranchTag.ShouldBe("rc"); config.NextVersion.ShouldBe("2.0.0"); config.TagPrefix.ShouldBe("[vV|version-]"); + config.VersioningMode.ShouldBe(VersioningMode.ContinuousDelivery); + config.Branches["develop"].Tag.ShouldBe("dev"); + config.Branches["release[/-]"].Tag.ShouldBe("rc"); + config.Branches["release[/-]"].VersioningMode.ShouldBe(VersioningMode.ContinuousDeployment); + config.Branches["develop"].VersioningMode.ShouldBe(VersioningMode.ContinuousDeployment); + } + + [Test] + public void CanInheritVersioningMode() + { + const string text = @" +mode: ContinuousDelivery +branches: + develop: + mode: ContinuousDeployment +"; + SetupConfigFileContent(text); + var config = ConfigurationProvider.Provide(gitDirectory, fileSystem); + config.Branches["develop"].VersioningMode.ShouldBe(VersioningMode.ContinuousDeployment); + config.Release.VersioningMode.ShouldBe(VersioningMode.ContinuousDelivery); + config.Develop.Tag.ShouldBe("unstable"); } [Test] public void CanReadOldDocument() { - const string text = @"assemblyVersioningScheme: MajorMinor"; + const string text = @" +assemblyVersioningScheme: MajorMinor +develop-branch-tag: alpha +release-branch-tag: rc +"; SetupConfigFileContent(text); var config = ConfigurationProvider.Provide(gitDirectory, fileSystem); config.AssemblyVersioningScheme.ShouldBe(AssemblyVersioningScheme.MajorMinor); + config.Branches["develop"].Tag.ShouldBe("alpha"); + config.Branches["release[/-]"].Tag.ShouldBe("rc"); } [Test] @@ -57,8 +89,8 @@ public void CanReadDefaultDocument() SetupConfigFileContent(text); var config = ConfigurationProvider.Provide(gitDirectory, fileSystem); config.AssemblyVersioningScheme.ShouldBe(AssemblyVersioningScheme.MajorMinorPatch); - config.DevelopBranchTag.ShouldBe("unstable"); - config.ReleaseBranchTag.ShouldBe("beta"); + config.Branches["develop"].Tag.ShouldBe("unstable"); + config.Branches["release[/-]"].Tag.ShouldBe("beta"); config.TagPrefix.ShouldBe("[vV]"); config.NextVersion.ShouldBe(null); } @@ -67,7 +99,7 @@ public void CanReadDefaultDocument() public void VerifyInit() { var config = typeof(Config); - var aliases = config.GetProperties().Select(p => ((YamlAliasAttribute) p.GetCustomAttribute(typeof(YamlAliasAttribute))).Alias); + var aliases = config.GetProperties().Where(p => p.GetCustomAttribute() == null).Select(p => ((YamlAliasAttribute) p.GetCustomAttribute(typeof(YamlAliasAttribute))).Alias); var writer = new StringWriter(); ConfigReader.WriteSample(writer); @@ -83,7 +115,7 @@ public void VerifyInit() public void VerifyAliases() { var config = typeof(Config); - var propertiesMissingAlias = config.GetProperties().Where(p => p.GetCustomAttribute(typeof(YamlAliasAttribute)) == null).Select(p => p.Name); + var propertiesMissingAlias = config.GetProperties().Where(p => p.GetCustomAttribute() == null).Where(p => p.GetCustomAttribute(typeof(YamlAliasAttribute)) == null).Select(p => p.Name); propertiesMissingAlias.ShouldBeEmpty(); } diff --git a/GitVersionCore.Tests/IntegrationTests/GitFlow/DevelopScenarios.cs b/GitVersionCore.Tests/IntegrationTests/GitFlow/DevelopScenarios.cs index 32f0b504a9..1c166561a3 100644 --- a/GitVersionCore.Tests/IntegrationTests/GitFlow/DevelopScenarios.cs +++ b/GitVersionCore.Tests/IntegrationTests/GitFlow/DevelopScenarios.cs @@ -35,23 +35,36 @@ public void MergingReleaseBranchBackIntoDevelopWithoutMergingToMaster_DoesNotBum [Test] public void CanChangeDevelopTagViaConfig() { - using (var fixture = new EmptyRepositoryFixture(new Config - { - DevelopBranchTag = "alpha" - })) + var config = new Config(); + config.Branches["develop"].Tag = "alpha"; + using (var fixture = new EmptyRepositoryFixture(config)) { fixture.Repository.MakeATaggedCommit("1.0.0"); fixture.Repository.CreateBranch("develop").Checkout(); fixture.AssertFullSemver("1.1.0-alpha.0+0"); } } + + [Test] + public void CanHandleContinuousDelivery() + { + var config = new Config(); + config.Branches["develop"].VersioningMode = VersioningMode.ContinuousDelivery; + using (var fixture = new EmptyRepositoryFixture(config)) + { + fixture.Repository.MakeATaggedCommit("1.0.0"); + fixture.Repository.CreateBranch("develop").Checkout(); + fixture.Repository.MakeATaggedCommit("1.1.0-alpha7"); + fixture.AssertFullSemver("1.1.0-alpha.7+1"); + } + } [Test] public void CanClearDevelopTagViaConfig() { using (var fixture = new EmptyRepositoryFixture(new Config { - DevelopBranchTag = "" + Develop = {Tag= ""} })) { fixture.Repository.MakeATaggedCommit("1.0.0"); diff --git a/GitVersionCore.Tests/IntegrationTests/GitFlow/ReleaseBranchTests.cs b/GitVersionCore.Tests/IntegrationTests/GitFlow/ReleaseBranchTests.cs index be36693040..4d47306041 100644 --- a/GitVersionCore.Tests/IntegrationTests/GitFlow/ReleaseBranchTests.cs +++ b/GitVersionCore.Tests/IntegrationTests/GitFlow/ReleaseBranchTests.cs @@ -35,6 +35,25 @@ public void CanTakeVersionFromReleaseBranchWithTagOverriden() } } + [Test] + public void CanHandleContinuousDeployment() + { + var config = new Config + { + VersioningMode = VersioningMode.ContinuousDeployment + }; + using (var fixture = new EmptyRepositoryFixture(config)) + { + fixture.Repository.MakeATaggedCommit("1.0.3"); + fixture.Repository.CreateBranch("develop"); + fixture.Repository.MakeCommits(5); + fixture.Repository.CreateBranch("release-2.0.0"); + fixture.Repository.Checkout("release-2.0.0"); + + fixture.AssertFullSemver("2.0.0-beta.5+5"); + } + } + [Test] public void CanHandleReleaseBranchWithStability() { diff --git a/GitVersionCore/Configuration/BranchConfig.cs b/GitVersionCore/Configuration/BranchConfig.cs new file mode 100644 index 0000000000..ebe25de3c6 --- /dev/null +++ b/GitVersionCore/Configuration/BranchConfig.cs @@ -0,0 +1,13 @@ +namespace GitVersion +{ + using YamlDotNet.Serialization; + + public class BranchConfig + { + [YamlAlias("mode")] + public VersioningMode VersioningMode { get; set; } + + [YamlAlias("tag")] + public string Tag { get; set; } + } +} diff --git a/GitVersionCore/Configuration/Config.cs b/GitVersionCore/Configuration/Config.cs index a7ea65d89c..8c481fbe8a 100644 --- a/GitVersionCore/Configuration/Config.cs +++ b/GitVersionCore/Configuration/Config.cs @@ -1,30 +1,118 @@ namespace GitVersion { + using System; + using System.Collections.Generic; + using System.Linq; + using YamlDotNet.Serialization; public class Config { + VersioningMode versioningMode; + + Dictionary branches = new Dictionary(); + public Config() { AssemblyVersioningScheme = AssemblyVersioningScheme.MajorMinorPatch; - DevelopBranchTag = "unstable"; - ReleaseBranchTag = "beta"; TagPrefix = "[vV]"; + Branches["release[/-]"] = new BranchConfig { Tag = "beta" }; + Branches["develop"] = new BranchConfig { Tag = "unstable" }; + VersioningMode = VersioningMode.ContinuousDelivery; + Develop.VersioningMode = VersioningMode.ContinuousDeployment; } [YamlAlias("assembly-versioning-scheme")] public AssemblyVersioningScheme AssemblyVersioningScheme { get; set; } [YamlAlias("develop-branch-tag")] - public string DevelopBranchTag { get; set; } + [Obsolete] + public string DevelopBranchTag + { + set + { + Develop.Tag = value; + } + get + { + return Develop.Tag; + } + } [YamlAlias("release-branch-tag")] - public string ReleaseBranchTag { get; set; } + [Obsolete] + public string ReleaseBranchTag + { + set + { + Release.Tag = value; + } + get + { + return Release.Tag; + } + } + + [YamlAlias("mode")] + public VersioningMode VersioningMode + { + get + { + return versioningMode; + } + set + { + Branches.ToList().ForEach(b => b.Value.VersioningMode = value); + versioningMode = value; + } + } + + [YamlAlias("branches")] + public Dictionary Branches + { + get + { + return branches; + } + set + { + value.ToList().ForEach(_ => branches[_.Key] = MergeObjects(branches[_.Key], _.Value)); + } + } + + private T MergeObjects(T target, T source) + { + typeof(T).GetProperties() + .Where(prop => prop.CanRead && prop.CanWrite) + .Select(_ => new {prop = _, value =_.GetValue(source, null) } ) + .Where(_ => _.value != null) + .ToList() + .ForEach(_ => _.prop.SetValue(target, _.value, null)); + return target; + } [YamlAlias("tag-prefix")] public string TagPrefix { get; set; } [YamlAlias("next-version")] public string NextVersion { get; set; } + + [Obsolete] + public BranchConfig Develop + { + get + { + return Branches["develop"]; + } + } + + [Obsolete] + public BranchConfig Release + { + get + { + return Branches["release[/-]"]; + } + } } } \ No newline at end of file diff --git a/GitVersionCore/Configuration/ConfigReader.cs b/GitVersionCore/Configuration/ConfigReader.cs index 73bd570259..79469adb70 100644 --- a/GitVersionCore/Configuration/ConfigReader.cs +++ b/GitVersionCore/Configuration/ConfigReader.cs @@ -20,10 +20,12 @@ public static Config Read(TextReader reader) public static void WriteSample(TextWriter writer) { writer.WriteLine("# assembly-versioning-scheme: MajorMinorPatchMetadata | MajorMinorPatch | MajorMinor | Major"); - writer.WriteLine("# develop-branch-tag: alpha"); - writer.WriteLine("# release-branch-tag: rc"); writer.WriteLine("# tag-prefix: '[vV|version-] # regex to match git tag prefix"); writer.WriteLine("# next-version: 1.0.0"); + writer.WriteLine("# mode: ContinuousDelivery | ContinuousDeployment"); + writer.WriteLine("#branches:"); + writer.WriteLine("# release[/-]*:\n mode: ContinuousDelivery | ContinuousDeployment\n tag: rc"); + writer.WriteLine("# develop:\n mode: ContinuousDelivery | ContinuousDeployment\n tag: alpha"); } } } \ No newline at end of file diff --git a/GitVersionCore/GitFlow/BranchFinders/DevelopBasedVersionFinderBase.cs b/GitVersionCore/GitFlow/BranchFinders/DevelopBasedVersionFinderBase.cs index fc52a919a0..02365cca81 100644 --- a/GitVersionCore/GitFlow/BranchFinders/DevelopBasedVersionFinderBase.cs +++ b/GitVersionCore/GitFlow/BranchFinders/DevelopBasedVersionFinderBase.cs @@ -9,6 +9,7 @@ protected SemanticVersion FindVersion( GitVersionContext context, BranchType branchType) { + context.CurrentBranchConfig = context.Configuration.Branches["develop"]; var ancestor = FindCommonAncestorWithDevelop(context.Repository, context.CurrentBranch, branchType); if (!IsThereAnyCommitOnTheBranch(context.Repository, context.CurrentBranch)) diff --git a/GitVersionCore/GitFlow/BranchFinders/DevelopVersionFinder.cs b/GitVersionCore/GitFlow/BranchFinders/DevelopVersionFinder.cs index 16192f4aad..cf1a05fb21 100644 --- a/GitVersionCore/GitFlow/BranchFinders/DevelopVersionFinder.cs +++ b/GitVersionCore/GitFlow/BranchFinders/DevelopVersionFinder.cs @@ -21,12 +21,23 @@ public SemanticVersion FindVersion(GitVersionContext context) var c = context.Repository.Commits.QueryBy(f); var numberOfCommitsSinceRelease = c.Count(); + var shortVersion = new SemanticVersion + { + Major = versionFromMaster.Major, + Minor = versionFromMaster.Minor + 1, + Patch = 0, + }; + + var applicableTagsInDescendingOrder = context.Repository.SemVerTagsRelatedToVersion(context.Configuration, shortVersion).OrderByDescending(tag => SemanticVersion.Parse(tag.Name, context.Configuration.TagPrefix)).ToList(); + var preReleaseTag = context.CurrentBranchConfig.VersioningMode.GetInstance().GetPreReleaseTag(context, applicableTagsInDescendingOrder, numberOfCommitsSinceRelease); + + var semanticVersion = new SemanticVersion { - Major = versionFromMaster.Major, - Minor = versionFromMaster.Minor + 1, - Patch = 0, - PreReleaseTag = context.Configuration.DevelopBranchTag + numberOfCommitsSinceRelease, + Major = shortVersion.Major, + Minor = shortVersion.Minor, + Patch = shortVersion.Patch, + PreReleaseTag = preReleaseTag, BuildMetaData = new SemanticVersionBuildMetaData(numberOfCommitsSinceRelease, context.CurrentBranch.Name,tip.Sha,tip.When()), }; diff --git a/GitVersionCore/GitFlow/BranchFinders/HotfixVersionFinder.cs b/GitVersionCore/GitFlow/BranchFinders/HotfixVersionFinder.cs index 2c57012103..60bf4937ac 100644 --- a/GitVersionCore/GitFlow/BranchFinders/HotfixVersionFinder.cs +++ b/GitVersionCore/GitFlow/BranchFinders/HotfixVersionFinder.cs @@ -1,5 +1,7 @@ namespace GitVersion { + using System.Linq; + using LibGit2Sharp; class HotfixVersionFinder @@ -12,8 +14,8 @@ public SemanticVersion FindVersion(GitVersionContext context) EnsureVersionIsValid(shortVersion, context.CurrentBranch); var nbHotfixCommits = BranchCommitDifferenceFinder.NumberOfCommitsInBranchNotKnownFromBaseBranch(context.Repository, context.CurrentBranch, BranchType.Hotfix, "master"); - - var semanticVersionPreReleaseTag = GetSemanticVersionPreReleaseTag(context, shortVersion, nbHotfixCommits); + var tagsInDescendingOrder = context.Repository.SemVerTagsRelatedToVersion(context.Configuration, shortVersion).OrderByDescending(tag => SemanticVersion.Parse(tag.Name, context.Configuration.TagPrefix)).ToList(); + var semanticVersionPreReleaseTag = context.CurrentBranchConfig.VersioningMode.GetInstance().GetPreReleaseTag(context, tagsInDescendingOrder, nbHotfixCommits); return new SemanticVersion { Major = shortVersion.Major, @@ -24,17 +26,6 @@ public SemanticVersion FindVersion(GitVersionContext context) }; } - static string GetSemanticVersionPreReleaseTag(GitVersionContext context, SemanticVersion shortVersion, int nbHotfixCommits) - { - var semanticVersionPreReleaseTag = context.Configuration.ReleaseBranchTag + ".1"; - var tagVersion = RecentTagVersionExtractor.RetrieveMostRecentOptionalTagVersion(context, shortVersion); - if (tagVersion != null) - { - semanticVersionPreReleaseTag = tagVersion; - } - return semanticVersionPreReleaseTag; - } - static string GetSuffix(Branch branch) { return branch.Name.TrimStart("hotfix-").TrimStart("hotfix/"); diff --git a/GitVersionCore/GitFlow/BranchFinders/RecentTagVersionExtractor.cs b/GitVersionCore/GitFlow/BranchFinders/RecentTagVersionExtractor.cs index 09f7fc1088..ec924c5431 100644 --- a/GitVersionCore/GitFlow/BranchFinders/RecentTagVersionExtractor.cs +++ b/GitVersionCore/GitFlow/BranchFinders/RecentTagVersionExtractor.cs @@ -6,12 +6,6 @@ namespace GitVersion class RecentTagVersionExtractor { - internal static SemanticVersionPreReleaseTag RetrieveMostRecentOptionalTagVersion(GitVersionContext context, SemanticVersion matchVersion) - { - var tagsInDescendingOrder = context.Repository.SemVerTagsRelatedToVersion(context.Configuration, matchVersion).OrderByDescending(tag => SemanticVersion.Parse(tag.Name, context.Configuration.TagPrefix)); - return RetrieveMostRecentOptionalTagVersion(context, tagsInDescendingOrder.ToList()); - } - internal static SemanticVersionPreReleaseTag RetrieveMostRecentOptionalTagVersion(GitVersionContext context, List applicableTagsInDescendingOrder) { if (applicableTagsInDescendingOrder.Any()) diff --git a/GitVersionCore/GitFlow/BranchFinders/ReleaseVersionFinder.cs b/GitVersionCore/GitFlow/BranchFinders/ReleaseVersionFinder.cs index f159c3c743..463bc54327 100644 --- a/GitVersionCore/GitFlow/BranchFinders/ReleaseVersionFinder.cs +++ b/GitVersionCore/GitFlow/BranchFinders/ReleaseVersionFinder.cs @@ -14,7 +14,7 @@ public SemanticVersion FindVersion(GitVersionContext context) var applicableTagsInDescendingOrder = context.Repository.SemVerTagsRelatedToVersion(context.Configuration, shortVersion).OrderByDescending(tag => SemanticVersion.Parse(tag.Name, context.Configuration.TagPrefix)).ToList(); var numberOfCommitsSinceLastTagOrBranchPoint = BranchCommitDifferenceFinder.NumberOfCommitsSinceLastTagOrBranchPoint(context, applicableTagsInDescendingOrder, BranchType.Release, "develop"); - var semanticVersionPreReleaseTag = RecentTagVersionExtractor.RetrieveMostRecentOptionalTagVersion(context, applicableTagsInDescendingOrder) ?? context.Configuration.ReleaseBranchTag + ".1"; + var semanticVersionPreReleaseTag = context.Configuration.Branches["release[/-]"].VersioningMode.GetInstance().GetPreReleaseTag(context, applicableTagsInDescendingOrder, numberOfCommitsSinceLastTagOrBranchPoint); return new SemanticVersion { diff --git a/GitVersionCore/GitFlow/GitFlowVersionFinder.cs b/GitVersionCore/GitFlow/GitFlowVersionFinder.cs index 9ba18ac429..cf31bf9cd3 100644 --- a/GitVersionCore/GitFlow/GitFlowVersionFinder.cs +++ b/GitVersionCore/GitFlow/GitFlowVersionFinder.cs @@ -11,16 +11,19 @@ public SemanticVersion FindVersion(GitVersionContext context) if (context.CurrentBranch.IsHotfix()) { + context.CurrentBranchConfig = context.Configuration.Branches["release[/-]"]; return new HotfixVersionFinder().FindVersion(context); } if (context.CurrentBranch.IsRelease()) { + context.CurrentBranchConfig = context.Configuration.Branches["release[/-]"]; return new ReleaseVersionFinder().FindVersion(context); } if (context.CurrentBranch.IsDevelop()) { + context.CurrentBranchConfig = context.Configuration.Branches["develop"]; return new DevelopVersionFinder().FindVersion(context); } diff --git a/GitVersionCore/GitHubFlow/OtherBranchVersionFinder.cs b/GitVersionCore/GitHubFlow/OtherBranchVersionFinder.cs index b2af983173..c95307e876 100644 --- a/GitVersionCore/GitHubFlow/OtherBranchVersionFinder.cs +++ b/GitVersionCore/GitHubFlow/OtherBranchVersionFinder.cs @@ -23,7 +23,7 @@ public bool FindVersion(GitVersionContext context, out SemanticVersion semanticV if (semanticVersionPreReleaseTag.Name == "release") { - semanticVersionPreReleaseTag.Name = context.Configuration.ReleaseBranchTag; + semanticVersionPreReleaseTag.Name = context.Configuration.Branches["release[/-]"].Tag; } semanticVersion = new SemanticVersion diff --git a/GitVersionCore/GitVersionContext.cs b/GitVersionCore/GitVersionContext.cs index 05e754cce0..3b8759de87 100644 --- a/GitVersionCore/GitVersionContext.cs +++ b/GitVersionCore/GitVersionContext.cs @@ -40,6 +40,8 @@ public GitVersionContext(IRepository repository, Branch currentBranch, Config co public Branch CurrentBranch { get; private set; } public Commit CurrentCommit { get; private set; } + public BranchConfig CurrentBranchConfig { get; set; } + IEnumerable GetBranchesContainingCommit(string commitSha) { var directBranchHasBeenFound = false; diff --git a/GitVersionCore/GitVersionCore.csproj b/GitVersionCore/GitVersionCore.csproj index b8a032181a..1ad027dc05 100644 --- a/GitVersionCore/GitVersionCore.csproj +++ b/GitVersionCore/GitVersionCore.csproj @@ -70,6 +70,7 @@ + @@ -79,6 +80,10 @@ + + + + diff --git a/GitVersionCore/VersioningModes/ContinuousDeliveryMode.cs b/GitVersionCore/VersioningModes/ContinuousDeliveryMode.cs new file mode 100644 index 0000000000..8a0b2854bc --- /dev/null +++ b/GitVersionCore/VersioningModes/ContinuousDeliveryMode.cs @@ -0,0 +1,15 @@ +namespace GitVersion.VersioningModes +{ + using System.Collections.Generic; + + using LibGit2Sharp; + + public class ContinuousDeliveryMode : VersioningModeBase + { + public override SemanticVersionPreReleaseTag GetPreReleaseTag(GitVersionContext context, List possibleCommits, int numberOfCommits) + { + return RecentTagVersionExtractor.RetrieveMostRecentOptionalTagVersion(context, possibleCommits) + ?? context.CurrentBranchConfig.Tag + ".1"; + } + } +} diff --git a/GitVersionCore/VersioningModes/ContinuousDeploymentMode.cs b/GitVersionCore/VersioningModes/ContinuousDeploymentMode.cs new file mode 100644 index 0000000000..45aafddc5a --- /dev/null +++ b/GitVersionCore/VersioningModes/ContinuousDeploymentMode.cs @@ -0,0 +1,14 @@ +namespace GitVersion.VersioningModes +{ + using System.Collections.Generic; + + using LibGit2Sharp; + + public class ContinuousDeploymentMode : VersioningModeBase + { + public override SemanticVersionPreReleaseTag GetPreReleaseTag(GitVersionContext context, List possibleTags, int numberOfCommits) + { + return context.CurrentBranchConfig.Tag + "." + numberOfCommits; + } + } +} \ No newline at end of file diff --git a/GitVersionCore/VersioningModes/VersioningMode.cs b/GitVersionCore/VersioningModes/VersioningMode.cs new file mode 100644 index 0000000000..55e48fa811 --- /dev/null +++ b/GitVersionCore/VersioningModes/VersioningMode.cs @@ -0,0 +1,28 @@ +namespace GitVersion +{ + using System; + + using GitVersion.VersioningModes; + + public enum VersioningMode + { + ContinuousDelivery, + ContinuousDeployment + } + + public static class VersioningModeExtension + { + public static VersioningModeBase GetInstance(this VersioningMode _this) + { + switch (_this) + { + case VersioningMode.ContinuousDelivery: + return new ContinuousDeliveryMode(); + case VersioningMode.ContinuousDeployment: + return new ContinuousDeploymentMode(); + default: + throw new ArgumentException("No instance exists for this versioning mode."); + } + } + } +} diff --git a/GitVersionCore/VersioningModes/VersioningModeBase.cs b/GitVersionCore/VersioningModes/VersioningModeBase.cs new file mode 100644 index 0000000000..98f15ca9a3 --- /dev/null +++ b/GitVersionCore/VersioningModes/VersioningModeBase.cs @@ -0,0 +1,11 @@ +namespace GitVersion.VersioningModes +{ + using System.Collections.Generic; + + using LibGit2Sharp; + + public abstract class VersioningModeBase + { + public abstract SemanticVersionPreReleaseTag GetPreReleaseTag(GitVersionContext context, List possibleTags, int numberOfCommits); + } +}