Skip to content

Commit 948bc9e

Browse files
committed
Rename ConfigNextVersionVersionStrategy to ConfiguredNextVersionVersionStrategy
1 parent e8176a6 commit 948bc9e

File tree

11 files changed

+42
-59
lines changed

11 files changed

+42
-59
lines changed

BREAKING_CHANGES.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
* ContinuousDelivery (previously ContinuousDeployment)
4040
* ContinuousDeployment (new)
4141
* At the configuration root level, a new array called `strategies` has been introduced, which can consist of on or more following values:
42-
* ConfigNextVersion
42+
* ConfiguredNextVersion
4343
* MergeMessage
4444
* TaggedCommit
4545
* TrackReleaseBranches

docs/input/docs/reference/configuration.md

+26-43
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ The global configuration looks like this:
4343
assembly-versioning-scheme: MajorMinorPatch
4444
assembly-file-versioning-scheme: MajorMinorPatch
4545
tag-prefix: '[vV]?'
46-
version-in-branch-pattern: (?<version>[vV]?\d+(\.\d+)?(\.\d+)?).*
4746
major-version-bump-message: '\+semver:\s?(breaking|major)'
4847
minor-version-bump-message: '\+semver:\s?(feature|minor)'
4948
patch-version-bump-message: '\+semver:\s?(fix|patch)'
@@ -53,30 +52,21 @@ commit-date-format: yyyy-MM-dd
5352
merge-message-formats: {}
5453
update-build-number: true
5554
semantic-version-format: Strict
56-
strategies:
57-
- ConfigNextVersion
58-
- MergeMessage
59-
- TaggedCommit
60-
- TrackReleaseBranches
61-
- VersionInBranchName
55+
strategies: [ConfigNext, MergeMessage, TaggedCommit, TrackReleaseBranches, VersionInBranchName]
6256
branches:
6357
develop:
64-
tracks-release-branches: true
65-
is-release-branch: false
66-
is-main-branch: false
67-
pre-release-weight: 0
58+
mode: ContinuousDeployment
6859
label: alpha
6960
increment: Minor
7061
prevent-increment-of-merged-branch-version: false
7162
track-merge-target: true
7263
regex: ^dev(elop)?(ment)?$
7364
source-branches: []
74-
is-source-branch-for: []
75-
main:
76-
tracks-release-branches: false
65+
tracks-release-branches: true
7766
is-release-branch: false
78-
is-main-branch: true
79-
pre-release-weight: 55000
67+
is-main-branch: false
68+
pre-release-weight: 0
69+
main:
8070
label: ''
8171
increment: Patch
8272
prevent-increment-of-merged-branch-version: true
@@ -85,13 +75,11 @@ branches:
8575
source-branches:
8676
- develop
8777
- release
88-
is-source-branch-for: []
89-
release:
9078
tracks-release-branches: false
91-
is-release-branch: true
92-
is-main-branch: false
93-
pre-release-weight: 30000
94-
mode: ManualDeployment
79+
is-release-branch: false
80+
is-main-branch: true
81+
pre-release-weight: 55000
82+
release:
9583
label: beta
9684
increment: None
9785
prevent-increment-of-merged-branch-version: true
@@ -102,10 +90,12 @@ branches:
10290
- main
10391
- support
10492
- release
105-
is-source-branch-for: []
106-
feature:
93+
tracks-release-branches: false
94+
is-release-branch: true
95+
is-main-branch: false
10796
pre-release-weight: 30000
108-
mode: ManualDeployment
97+
feature:
98+
mode: ContinuousDelivery
10999
label: '{BranchName}'
110100
increment: Inherit
111101
regex: ^features?[/-](?<BranchName>.+)
@@ -116,9 +106,8 @@ branches:
116106
- feature
117107
- support
118108
- hotfix
119-
is-source-branch-for: []
120-
pull-request:
121109
pre-release-weight: 30000
110+
pull-request:
122111
mode: ContinuousDelivery
123112
label: PullRequest
124113
increment: Inherit
@@ -131,11 +120,9 @@ branches:
131120
- feature
132121
- support
133122
- hotfix
134-
is-source-branch-for: []
135-
hotfix:
136-
is-release-branch: true
137123
pre-release-weight: 30000
138-
mode: ManualDeployment
124+
hotfix:
125+
mode: ContinuousDelivery
139126
label: beta
140127
increment: Inherit
141128
regex: ^hotfix(es)?[/-]
@@ -144,25 +131,24 @@ branches:
144131
- main
145132
- support
146133
- hotfix
147-
is-source-branch-for: []
134+
pre-release-weight: 30000
148135
support:
149-
tracks-release-branches: false
150-
is-release-branch: false
151-
is-main-branch: true
152-
pre-release-weight: 55000
153136
label: ''
154137
increment: Patch
155138
prevent-increment-of-merged-branch-version: true
156139
track-merge-target: false
157140
regex: ^support[/-]
158141
source-branches:
159142
- main
160-
is-source-branch-for: []
143+
tracks-release-branches: false
144+
is-release-branch: false
145+
is-main-branch: true
146+
pre-release-weight: 55000
161147
unknown:
162-
mode: ManualDeployment
148+
mode: ContinuousDelivery
163149
label: '{BranchName}'
164150
increment: Inherit
165-
regex: (?<BranchName>.+)
151+
regex: (?<BranchName>.*)
166152
source-branches:
167153
- main
168154
- develop
@@ -171,7 +157,6 @@ branches:
171157
- pull-request
172158
- hotfix
173159
- support
174-
is-source-branch-for: []
175160
ignore:
176161
sha: []
177162
mode: ContinuousDelivery
@@ -182,8 +167,6 @@ track-merge-target: false
182167
track-merge-message: true
183168
commit-message-incrementing: Enabled
184169
regex: ''
185-
source-branches: []
186-
is-source-branch-for: []
187170
tracks-release-branches: false
188171
is-release-branch: false
189172
is-main-branch: false
@@ -694,7 +677,7 @@ Example of invalid `Strict`, but valid `Loose`
694677
### strategies
695678
696679
Specifies which version strategy implementation (one ore more) will be used to determine the next version. Following values are supported and can be combined:
697-
* ConfigNextVersion
680+
* ConfiguredNextVersion
698681
* MergeMessage
699682
* TaggedCommit
700683
* TrackReleaseBranches

src/GitVersion.Configuration.Tests/Configuration/ConfigurationProviderTests.CanWriteOutEffectiveConfiguration.approved.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ merge-message-formats: {}
1212
update-build-number: true
1313
semantic-version-format: Strict
1414
strategies:
15-
- ConfigNextVersion
15+
- ConfiguredNextVersion
1616
- MergeMessage
1717
- TaggedCommit
1818
- TrackReleaseBranches

src/GitVersion.Configuration.Tests/Configuration/ConfigurationProviderTests.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,13 @@ public void OverwritesDefaultsWithProvidedConfig()
6060
public void CombineVersionStrategyConfigNextAndTaggedCommit()
6161
{
6262
// Arrange
63-
SetupConfigFileContent("strategies: [ConfigNextVersion, TaggedCommit]");
63+
SetupConfigFileContent("strategies: [ConfiguredNextVersion, TaggedCommit]");
6464

6565
// Act
6666
var configuration = this.configurationProvider.ProvideForDirectory(this.repoPath);
6767

6868
// Assert
69-
configuration.VersionStrategy.ShouldBe(VersionStrategies.ConfigNextVersion | VersionStrategies.TaggedCommit);
69+
configuration.VersionStrategy.ShouldBe(VersionStrategies.ConfiguredNextVersion | VersionStrategies.TaggedCommit);
7070
}
7171

7272
[Test]

src/GitVersion.Configuration/GitVersionConfiguration.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ public string? NextVersion
129129
? VersionCalculation.VersionStrategies.None : VersionStrategies.Aggregate((one, another) => one | another);
130130

131131
[JsonPropertyName("strategies")]
132-
[JsonPropertyDescription($"Specifies which version strategies (one or more) will be used to determine the next version. Following values are available: 'ConfigNextVersion', 'MergeMessage', 'TaggedCommit', 'TrackReleaseBranches', 'VersionInBranchName' and 'TrunkBased'.")]
132+
[JsonPropertyDescription($"Specifies which version strategies (one or more) will be used to determine the next version. Following values are available: 'ConfiguredNextVersion', 'MergeMessage', 'TaggedCommit', 'TrackReleaseBranches', 'VersionInBranchName' and 'TrunkBased'.")]
133133
public VersionStrategies[] VersionStrategies { get; internal set; } = [];
134134

135135
[JsonIgnore]

src/GitVersion.Configuration/SupportedWorkflows/TrunkBased/v1.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ commit-date-format: yyyy-MM-dd
1010
merge-message-formats: {}
1111
update-build-number: true
1212
semantic-version-format: Strict
13-
strategies: [TrunkBased, ConfigNextVersion]
13+
strategies: [TrunkBased, ConfiguredNextVersion]
1414
branches:
1515
main:
1616
mode: ContinuousDeployment

src/GitVersion.Core.Tests/VersionCalculation/Strategies/ConfigNextVersionBaseVersionStrategyTests.cs

+4-4
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
namespace GitVersion.Core.Tests.VersionCalculation.Strategies;
88

99
[TestFixture]
10-
public class ConfigNextVersionBaseVersionStrategyTests : TestBase
10+
public class ConfiguredNextVersionBaseVersionStrategyTests : TestBase
1111
{
1212
[Test]
1313
public void ReturnsNullWhenNoNextVersionIsInConfig()
@@ -22,7 +22,7 @@ public void ReturnsNullWhenNoNextVersionIsInConfig()
2222
[TestCase("2.12.654651698", "2.12.654651698", SemanticVersionFormat.Strict)]
2323
[TestCase("2.12.654651698", "2.12.654651698", SemanticVersionFormat.Loose)]
2424
[TestCase("0.1", "0.1.0", SemanticVersionFormat.Loose)]
25-
public void ConfigNextVersionTest(string nextVersion, string expectedVersion, SemanticVersionFormat versionFormat)
25+
public void ConfiguredNextVersionTest(string nextVersion, string expectedVersion, SemanticVersionFormat versionFormat)
2626
{
2727
var overrideConfiguration = new Dictionary<object, object?>
2828
{
@@ -37,7 +37,7 @@ public void ConfigNextVersionTest(string nextVersion, string expectedVersion, Se
3737
}
3838

3939
[TestCase("0.1", SemanticVersionFormat.Strict)]
40-
public void ConfigNextVersionTestShouldFail(string nextVersion, SemanticVersionFormat versionFormat)
40+
public void ConfiguredNextVersionTestShouldFail(string nextVersion, SemanticVersionFormat versionFormat)
4141
{
4242
var overrideConfiguration = new Dictionary<object, object?>
4343
{
@@ -54,7 +54,7 @@ public void ConfigNextVersionTestShouldFail(string nextVersion, SemanticVersionF
5454
var contextBuilder = new GitVersionContextBuilder().WithOverrideConfiguration(overrideConfiguration);
5555
contextBuilder.Build();
5656
contextBuilder.ServicesProvider.ShouldNotBeNull();
57-
var strategy = contextBuilder.ServicesProvider.GetServiceForType<IVersionStrategy, ConfigNextVersionVersionStrategy>();
57+
var strategy = contextBuilder.ServicesProvider.GetServiceForType<IVersionStrategy, ConfiguredNextVersionVersionStrategy>();
5858
var context = contextBuilder.ServicesProvider.GetRequiredService<Lazy<GitVersionContext>>().Value;
5959
var branchMock = GitToolsTestingExtensions.CreateMockBranch("main", GitToolsTestingExtensions.CreateMockCommit());
6060

src/GitVersion.Core/Configuration/ConfigurationConstants.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ internal static class ConfigurationConstants
1515
public const AssemblyFileVersioningScheme DefaultAssemblyFileVersioningScheme = AssemblyFileVersioningScheme.MajorMinorPatch;
1616
public const SemanticVersionFormat DefaultSemanticVersionFormat = SemanticVersionFormat.Strict;
1717
public static readonly VersionStrategies[] DefaultVersionStrategies = [
18-
VersionStrategies.ConfigNextVersion,
18+
VersionStrategies.ConfiguredNextVersion,
1919
VersionStrategies.MergeMessage,
2020
VersionStrategies.TaggedCommit,
2121
VersionStrategies.TrackReleaseBranches,

src/GitVersion.Core/PublicAPI.Unshipped.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -724,7 +724,7 @@ GitVersion.VersionCalculation.VersionCalculationModule
724724
GitVersion.VersionCalculation.VersionCalculationModule.RegisterTypes(Microsoft.Extensions.DependencyInjection.IServiceCollection! services) -> void
725725
GitVersion.VersionCalculation.VersionCalculationModule.VersionCalculationModule() -> void
726726
GitVersion.VersionCalculation.VersionStrategies
727-
GitVersion.VersionCalculation.VersionStrategies.ConfigNextVersion = 1 -> GitVersion.VersionCalculation.VersionStrategies
727+
GitVersion.VersionCalculation.VersionStrategies.ConfiguredNextVersion = 1 -> GitVersion.VersionCalculation.VersionStrategies
728728
GitVersion.VersionCalculation.VersionStrategies.MergeMessage = 2 -> GitVersion.VersionCalculation.VersionStrategies
729729
GitVersion.VersionCalculation.VersionStrategies.None = 0 -> GitVersion.VersionCalculation.VersionStrategies
730730
GitVersion.VersionCalculation.VersionStrategies.TaggedCommit = 4 -> GitVersion.VersionCalculation.VersionStrategies

src/GitVersion.Core/VersionCalculation/VersionSearchStrategies/ConfigNextVersionVersionStrategy.cs renamed to src/GitVersion.Core/VersionCalculation/VersionSearchStrategies/ConfiguredNextVersionVersionStrategy.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ namespace GitVersion.VersionCalculation;
88
/// BaseVersionSource is null.
99
/// Does not increment.
1010
/// </summary>
11-
internal class ConfigNextVersionVersionStrategy(Lazy<GitVersionContext> versionContext) : VersionStrategyBase(versionContext)
11+
internal class ConfiguredNextVersionVersionStrategy(Lazy<GitVersionContext> versionContext) : VersionStrategyBase(versionContext)
1212
{
1313
public override IEnumerable<BaseVersion> GetBaseVersions(EffectiveBranchConfiguration configuration)
1414
{
15-
if (!Context.Configuration.VersionStrategy.HasFlag(VersionStrategies.ConfigNextVersion))
15+
if (!Context.Configuration.VersionStrategy.HasFlag(VersionStrategies.ConfiguredNextVersion))
1616
yield break;
1717

1818
var contextConfiguration = Context.Configuration;

src/GitVersion.Core/VersionCalculation/VersionStrategies.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ namespace GitVersion.VersionCalculation;
44
public enum VersionStrategies
55
{
66
None = 0,
7-
ConfigNextVersion = 1,
7+
ConfiguredNextVersion = 1,
88
MergeMessage = 2,
99
TaggedCommit = 4,
1010
TrackReleaseBranches = 8,
1111
VersionInBranchName = 16,
12-
TrunkBased = 32,
12+
TrunkBased = 32
1313
}

0 commit comments

Comments
 (0)