Skip to content

Commit 6ae42cb

Browse files
authored
Merge pull request #3879 from HHobeck/feature/Replace-the-version-mode-Mainline-Part-II
Replace the version mode Mainline in 6.x (Part II)
2 parents 2f1b6a7 + 34d6300 commit 6ae42cb

File tree

57 files changed

+349
-660
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+349
-660
lines changed

BREAKING_CHANGES.md

+1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
* The `BranchPrefixToTrim` configuration property has been removed. `RegularExpression` is now used to capture named groups instead.
3333
* Default `RegularExpression` for feature branches is changed from `^features?[/-]` to `^features?[/-](?<BranchName>.+)` to support using `{BranchName}` out-of-the-box
3434
* Default `RegularExpression` for unknown branches is changed from `.*` to `(?<BranchName>.*)` to support using `{BranchName}` out-of-the-box
35+
* The branch related property `is-mainline` in the configuration system has been renamed to `is-main-branch`
3536
3637
## v5.0.0
3738

docs/input/docs/reference/configuration.md

+11-12
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ branches:
6565
is-source-branch-for: []
6666
tracks-release-branches: true
6767
is-release-branch: false
68-
is-mainline: false
68+
is-main-branch: false
6969
pre-release-weight: 0
7070
main:
7171
label: ''
@@ -79,7 +79,7 @@ branches:
7979
is-source-branch-for: []
8080
tracks-release-branches: false
8181
is-release-branch: false
82-
is-mainline: true
82+
is-main-branch: true
8383
pre-release-weight: 55000
8484
release:
8585
label: beta
@@ -95,7 +95,7 @@ branches:
9595
is-source-branch-for: []
9696
tracks-release-branches: false
9797
is-release-branch: true
98-
is-mainline: false
98+
is-main-branch: false
9999
pre-release-weight: 30000
100100
feature:
101101
mode: ContinuousDelivery
@@ -150,7 +150,7 @@ branches:
150150
is-source-branch-for: []
151151
tracks-release-branches: false
152152
is-release-branch: false
153-
is-mainline: true
153+
is-main-branch: true
154154
pre-release-weight: 55000
155155
unknown:
156156
mode: ContinuousDelivery
@@ -180,7 +180,7 @@ source-branches: []
180180
is-source-branch-for: []
181181
tracks-release-branches: false
182182
is-release-branch: false
183-
is-mainline: false
183+
is-main-branch: false
184184
```
185185
186186
The details of the available options are as follows:
@@ -413,7 +413,7 @@ branches:
413413
source-branches: [ 'develop', 'release' ]
414414
tracks-release-branches: false
415415
is-release-branch: false
416-
is-mainline: true
416+
is-main-branch: true
417417
pre-release-weight: 55000
418418
develop:
419419
regex: ^dev(elop)?(ment)?$
@@ -425,7 +425,7 @@ branches:
425425
source-branches: []
426426
tracks-release-branches: true
427427
is-release-branch: false
428-
is-mainline: false
428+
is-main-branch: false
429429
pre-release-weight: 0
430430
release:
431431
regex: ^releases?[/-]
@@ -437,7 +437,7 @@ branches:
437437
source-branches: [ 'develop', 'main', 'support', 'release' ]
438438
tracks-release-branches: false
439439
is-release-branch: true
440-
is-mainline: false
440+
is-main-branch: false
441441
pre-release-weight: 30000
442442
feature:
443443
regex: ^features?[/-]
@@ -471,7 +471,7 @@ branches:
471471
source-branches: [ 'main' ]
472472
tracks-release-branches: false
473473
is-release-branch: false
474-
is-mainline: true
474+
is-main-branch: true
475475
pre-release-weight: 55000
476476
```
477477

@@ -644,10 +644,9 @@ Indicates this branch config represents develop in GitFlow.
644644

645645
Indicates this branch config represents a release branch in GitFlow.
646646

647-
### is-mainline
647+
### is-main-branch
648648

649-
When using Mainline mode, this indicates that this branch is a mainline. By
650-
default `main` and `support/*` are mainlines.
649+
This indicates that this branch is a main branch. By default `main` and `support/*` are main branches.
651650

652651
### pre-release-weight
653652

schemas/6.0/GitVersion.configuration.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
"increment": {
7171
"$ref": "#/$defs/incrementStrategy"
7272
},
73-
"is-mainline": {
73+
"is-main-branch": {
7474
"$ref": "#/$defs/nullableOfBoolean"
7575
},
7676
"is-release-branch": {
@@ -191,7 +191,7 @@
191191
"increment": {
192192
"$ref": "#/$defs/incrementStrategy"
193193
},
194-
"is-mainline": {
194+
"is-main-branch": {
195195
"$ref": "#/$defs/nullableOfBoolean"
196196
},
197197
"is-release-branch": {
@@ -352,4 +352,4 @@
352352
}
353353
}
354354
}
355-
}
355+
}

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

+11-11
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ branches:
2222
is-source-branch-for: []
2323
tracks-release-branches: true
2424
is-release-branch: false
25-
is-mainline: false
25+
is-main-branch: false
2626
pre-release-weight: 0
2727
main:
2828
label: ''
@@ -36,10 +36,10 @@ branches:
3636
is-source-branch-for: []
3737
tracks-release-branches: false
3838
is-release-branch: false
39-
is-mainline: true
39+
is-main-branch: true
4040
pre-release-weight: 55000
4141
release:
42-
mode: ContinuousDelivery
42+
mode: ManualDeployment
4343
label: beta
4444
increment: None
4545
prevent-increment-of-merged-branch-version: true
@@ -53,10 +53,10 @@ branches:
5353
is-source-branch-for: []
5454
tracks-release-branches: false
5555
is-release-branch: true
56-
is-mainline: false
56+
is-main-branch: false
5757
pre-release-weight: 30000
5858
feature:
59-
mode: ContinuousDelivery
59+
mode: ManualDeployment
6060
label: '{BranchName}'
6161
increment: Inherit
6262
regex: ^features?[/-](?<BranchName>.+)
@@ -70,7 +70,7 @@ branches:
7070
is-source-branch-for: []
7171
pre-release-weight: 30000
7272
pull-request:
73-
mode: ContinuousDeployment
73+
mode: ContinuousDelivery
7474
label: PullRequest
7575
increment: Inherit
7676
label-number-pattern: '[/-](?<number>\d+)'
@@ -85,7 +85,7 @@ branches:
8585
is-source-branch-for: []
8686
pre-release-weight: 30000
8787
hotfix:
88-
mode: ContinuousDelivery
88+
mode: ManualDeployment
8989
label: beta
9090
increment: Inherit
9191
regex: ^hotfix(es)?[/-]
@@ -108,10 +108,10 @@ branches:
108108
is-source-branch-for: []
109109
tracks-release-branches: false
110110
is-release-branch: false
111-
is-mainline: true
111+
is-main-branch: true
112112
pre-release-weight: 55000
113113
unknown:
114-
mode: ContinuousDelivery
114+
mode: ManualDeployment
115115
label: '{BranchName}'
116116
increment: Inherit
117117
regex: (?<BranchName>.+)
@@ -126,7 +126,7 @@ branches:
126126
is-source-branch-for: []
127127
ignore:
128128
sha: []
129-
mode: ContinuousDeployment
129+
mode: ContinuousDelivery
130130
label: '{BranchName}'
131131
increment: Inherit
132132
prevent-increment-of-merged-branch-version: false
@@ -138,4 +138,4 @@ source-branches: []
138138
is-source-branch-for: []
139139
tracks-release-branches: false
140140
is-release-branch: false
141-
is-mainline: false
141+
is-main-branch: false

src/GitVersion.Configuration/BranchConfiguration.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,9 @@ internal record BranchConfiguration : IBranchConfiguration
7070
[JsonPropertyDescription("Indicates this branch configuration represents a release branch in GitFlow.")]
7171
public bool? IsReleaseBranch { get; internal set; }
7272

73-
[JsonPropertyName("is-mainline")]
73+
[JsonPropertyName("is-main-branch")]
7474
[JsonPropertyDescription("When using Mainline mode, this indicates that this branch is a mainline. By default main and support/* are mainlines.")]
75-
public bool? IsMainline { get; internal set; }
75+
public bool? IsMainBranch { get; internal set; }
7676

7777
[JsonPropertyName("pre-release-weight")]
7878
[JsonPropertyDescription("Provides a way to translate the PreReleaseLabel to a number.")]
@@ -96,7 +96,7 @@ public virtual IBranchConfiguration Inherit(IBranchConfiguration configuration)
9696
RegularExpression = RegularExpression ?? configuration.RegularExpression,
9797
TracksReleaseBranches = TracksReleaseBranches ?? configuration.TracksReleaseBranches,
9898
IsReleaseBranch = IsReleaseBranch ?? configuration.IsReleaseBranch,
99-
IsMainline = IsMainline ?? configuration.IsMainline,
99+
IsMainBranch = IsMainBranch ?? configuration.IsMainBranch,
100100
PreReleaseWeight = PreReleaseWeight ?? configuration.PreReleaseWeight
101101
};
102102
}

src/GitVersion.Configuration/BranchConfigurationBuilder.cs

+5-5
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ internal class BranchConfigurationBuilder
1919
private HashSet<string> isSourceBranchFor = [];
2020
private bool? tracksReleaseBranches;
2121
private bool? isReleaseBranch;
22-
private bool? isMainline;
22+
private bool? isMainBranch;
2323
private int? preReleaseWeight;
2424

2525
private BranchConfigurationBuilder()
@@ -116,9 +116,9 @@ public virtual BranchConfigurationBuilder WithIsReleaseBranch(bool? value)
116116
return this;
117117
}
118118

119-
public virtual BranchConfigurationBuilder WithIsMainline(bool? value)
119+
public virtual BranchConfigurationBuilder WithIsMainBranch(bool? value)
120120
{
121-
this.isMainline = value;
121+
this.isMainBranch = value;
122122
return this;
123123
}
124124

@@ -141,7 +141,7 @@ public virtual BranchConfigurationBuilder WithConfiguration(IBranchConfiguration
141141
WithRegularExpression(value.RegularExpression);
142142
WithTracksReleaseBranches(value.TracksReleaseBranches);
143143
WithIsReleaseBranch(value.IsReleaseBranch);
144-
WithIsMainline(value.IsMainline);
144+
WithIsMainBranch(value.IsMainBranch);
145145
WithPreReleaseWeight(value.PreReleaseWeight);
146146
WithSourceBranches(value.SourceBranches);
147147
WithIsSourceBranchFor(value.IsSourceBranchFor);
@@ -158,7 +158,7 @@ public virtual BranchConfigurationBuilder WithConfiguration(IBranchConfiguration
158158
TrackMergeTarget = trackMergeTarget,
159159
TrackMergeMessage = trackMergeMessage,
160160
CommitMessageIncrementing = commitMessageIncrementing,
161-
IsMainline = isMainline,
161+
IsMainBranch = isMainBranch,
162162
IsReleaseBranch = isReleaseBranch,
163163
LabelNumberPattern = labelNumberPattern,
164164
PreventIncrementOfMergedBranchVersion = preventIncrementOfMergedBranchVersion,

src/GitVersion.Configuration/ConfigurationBuilderBase.cs

+5-5
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ internal abstract class ConfigurationBuilderBase<TConfigurationBuilder> : IConfi
3838
private string? regularExpression;
3939
private bool? tracksReleaseBranches;
4040
private bool? isReleaseBranch;
41-
private bool? isMainline;
41+
private bool? isMainBranch;
4242
private int? preReleaseWeight;
4343

4444
protected readonly BranchMetaData MainBranch = new()
@@ -290,9 +290,9 @@ public virtual TConfigurationBuilder WithIsReleaseBranch(bool? value)
290290
return (TConfigurationBuilder)this;
291291
}
292292

293-
public virtual TConfigurationBuilder WithIsMainline(bool? value)
293+
public virtual TConfigurationBuilder WithIsMainBranch(bool? value)
294294
{
295-
this.isMainline = value;
295+
this.isMainBranch = value;
296296
return (TConfigurationBuilder)this;
297297
}
298298

@@ -337,7 +337,7 @@ public virtual TConfigurationBuilder WithConfiguration(IGitVersionConfiguration
337337
WithRegularExpression(value.RegularExpression);
338338
WithTracksReleaseBranches(value.TracksReleaseBranches);
339339
WithIsReleaseBranch(value.IsReleaseBranch);
340-
WithIsMainline(value.IsMainline);
340+
WithIsMainBranch(value.IsMainBranch);
341341
WithPreReleaseWeight(value.PreReleaseWeight);
342342
return (TConfigurationBuilder)this;
343343
}
@@ -387,7 +387,7 @@ public virtual IGitVersionConfiguration Build()
387387
TrackMergeTarget = this.trackMergeTarget,
388388
TrackMergeMessage = this.trackMergeMessage,
389389
CommitMessageIncrementing = this.commitMessageIncrementing,
390-
IsMainline = this.isMainline,
390+
IsMainBranch = this.isMainBranch,
391391
IsReleaseBranch = this.isReleaseBranch,
392392
LabelNumberPattern = this.labelNumberPattern,
393393
PreventIncrementOfMergedBranchVersion = this.preventIncrementOfMergedBranchVersion,

src/GitVersion.Configuration/ConfigurationFileLocator.cs

+4-4
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,12 @@ bool HasConfigurationFileAt(string fileName, out string? configFile)
6666

6767
private static void VerifyReadConfig(IGitVersionConfiguration configuration)
6868
{
69-
// Verify no branches are set to mainline mode
70-
if (configuration.Branches.Any(b => b.Value.VersioningMode == VersioningMode.Mainline))
69+
// Verify no branches are set to TrunkBased mode
70+
if (configuration.Branches.Any(b => b.Value.VersioningMode == VersioningMode.TrunkBased))
7171
{
72-
throw new ConfigurationException(@"Mainline mode only works at the repository level, a single branch cannot be put into mainline mode
72+
throw new ConfigurationException(@"TrunkBased mode only works at the repository level, a single branch cannot be put into TrunkBased mode
7373
74-
This is because mainline mode treats your entire git repository as an event source with each merge into the 'mainline' incrementing the version.
74+
This is because TrunkBased mode treats your entire git repository as an event source with each merge into the 'TrunkBased' incrementing the version.
7575
7676
If the docs do not help you decide on the mode open an issue to discuss what you are trying to do.");
7777
}

0 commit comments

Comments
 (0)