Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions BREAKING_CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
* The `BranchPrefixToTrim` configuration property has been removed. `RegularExpression` is now used to capture named groups instead.
* Default `RegularExpression` for feature branches is changed from `^features?[/-]` to `^features?[/-](?<BranchName>.+)` to support using `{BranchName}` out-of-the-box
* Default `RegularExpression` for unknown branches is changed from `.*` to `(?<BranchName>.*)` to support using `{BranchName}` out-of-the-box
* The branch related property `is-mainline` in the configuration system has been renamed to `is-main-branch`

## v5.0.0

Expand Down
23 changes: 11 additions & 12 deletions docs/input/docs/reference/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ branches:
is-source-branch-for: []
tracks-release-branches: true
is-release-branch: false
is-mainline: false
is-main-branch: false
pre-release-weight: 0
main:
label: ''
Expand All @@ -79,7 +79,7 @@ branches:
is-source-branch-for: []
tracks-release-branches: false
is-release-branch: false
is-mainline: true
is-main-branch: true
pre-release-weight: 55000
release:
label: beta
Expand All @@ -95,7 +95,7 @@ branches:
is-source-branch-for: []
tracks-release-branches: false
is-release-branch: true
is-mainline: false
is-main-branch: false
pre-release-weight: 30000
feature:
mode: ContinuousDelivery
Expand Down Expand Up @@ -150,7 +150,7 @@ branches:
is-source-branch-for: []
tracks-release-branches: false
is-release-branch: false
is-mainline: true
is-main-branch: true
pre-release-weight: 55000
unknown:
mode: ContinuousDelivery
Expand Down Expand Up @@ -180,7 +180,7 @@ source-branches: []
is-source-branch-for: []
tracks-release-branches: false
is-release-branch: false
is-mainline: false
is-main-branch: false
```

The details of the available options are as follows:
Expand Down Expand Up @@ -413,7 +413,7 @@ branches:
source-branches: [ 'develop', 'release' ]
tracks-release-branches: false
is-release-branch: false
is-mainline: true
is-main-branch: true
pre-release-weight: 55000
develop:
regex: ^dev(elop)?(ment)?$
Expand All @@ -425,7 +425,7 @@ branches:
source-branches: []
tracks-release-branches: true
is-release-branch: false
is-mainline: false
is-main-branch: false
pre-release-weight: 0
release:
regex: ^releases?[/-]
Expand All @@ -437,7 +437,7 @@ branches:
source-branches: [ 'develop', 'main', 'support', 'release' ]
tracks-release-branches: false
is-release-branch: true
is-mainline: false
is-main-branch: false
pre-release-weight: 30000
feature:
regex: ^features?[/-]
Expand Down Expand Up @@ -471,7 +471,7 @@ branches:
source-branches: [ 'main' ]
tracks-release-branches: false
is-release-branch: false
is-mainline: true
is-main-branch: true
pre-release-weight: 55000
```

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

Indicates this branch config represents a release branch in GitFlow.

### is-mainline
### is-main-branch

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

### pre-release-weight

Expand Down
6 changes: 3 additions & 3 deletions schemas/6.0/GitVersion.configuration.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
"increment": {
"$ref": "#/$defs/incrementStrategy"
},
"is-mainline": {
"is-main-branch": {
"$ref": "#/$defs/nullableOfBoolean"
},
"is-release-branch": {
Expand Down Expand Up @@ -191,7 +191,7 @@
"increment": {
"$ref": "#/$defs/incrementStrategy"
},
"is-mainline": {
"is-main-branch": {
"$ref": "#/$defs/nullableOfBoolean"
},
"is-release-branch": {
Expand Down Expand Up @@ -352,4 +352,4 @@
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ branches:
is-source-branch-for: []
tracks-release-branches: true
is-release-branch: false
is-mainline: false
is-main-branch: false
pre-release-weight: 0
main:
label: ''
Expand All @@ -36,10 +36,10 @@ branches:
is-source-branch-for: []
tracks-release-branches: false
is-release-branch: false
is-mainline: true
is-main-branch: true
pre-release-weight: 55000
release:
mode: ContinuousDelivery
mode: ManualDeployment
label: beta
increment: None
prevent-increment-of-merged-branch-version: true
Expand All @@ -53,10 +53,10 @@ branches:
is-source-branch-for: []
tracks-release-branches: false
is-release-branch: true
is-mainline: false
is-main-branch: false
pre-release-weight: 30000
feature:
mode: ContinuousDelivery
mode: ManualDeployment
label: '{BranchName}'
increment: Inherit
regex: ^features?[/-](?<BranchName>.+)
Expand All @@ -70,7 +70,7 @@ branches:
is-source-branch-for: []
pre-release-weight: 30000
pull-request:
mode: ContinuousDeployment
mode: ContinuousDelivery
label: PullRequest
increment: Inherit
label-number-pattern: '[/-](?<number>\d+)'
Expand All @@ -85,7 +85,7 @@ branches:
is-source-branch-for: []
pre-release-weight: 30000
hotfix:
mode: ContinuousDelivery
mode: ManualDeployment
label: beta
increment: Inherit
regex: ^hotfix(es)?[/-]
Expand All @@ -108,10 +108,10 @@ branches:
is-source-branch-for: []
tracks-release-branches: false
is-release-branch: false
is-mainline: true
is-main-branch: true
pre-release-weight: 55000
unknown:
mode: ContinuousDelivery
mode: ManualDeployment
label: '{BranchName}'
increment: Inherit
regex: (?<BranchName>.+)
Expand All @@ -126,7 +126,7 @@ branches:
is-source-branch-for: []
ignore:
sha: []
mode: ContinuousDeployment
mode: ContinuousDelivery
label: '{BranchName}'
increment: Inherit
prevent-increment-of-merged-branch-version: false
Expand All @@ -138,4 +138,4 @@ source-branches: []
is-source-branch-for: []
tracks-release-branches: false
is-release-branch: false
is-mainline: false
is-main-branch: false
6 changes: 3 additions & 3 deletions src/GitVersion.Configuration/BranchConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ internal record BranchConfiguration : IBranchConfiguration
[JsonPropertyDescription("Indicates this branch configuration represents a release branch in GitFlow.")]
public bool? IsReleaseBranch { get; internal set; }

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

[JsonPropertyName("pre-release-weight")]
[JsonPropertyDescription("Provides a way to translate the PreReleaseLabel to a number.")]
Expand All @@ -96,7 +96,7 @@ public virtual IBranchConfiguration Inherit(IBranchConfiguration configuration)
RegularExpression = RegularExpression ?? configuration.RegularExpression,
TracksReleaseBranches = TracksReleaseBranches ?? configuration.TracksReleaseBranches,
IsReleaseBranch = IsReleaseBranch ?? configuration.IsReleaseBranch,
IsMainline = IsMainline ?? configuration.IsMainline,
IsMainBranch = IsMainBranch ?? configuration.IsMainBranch,
PreReleaseWeight = PreReleaseWeight ?? configuration.PreReleaseWeight
};
}
Expand Down
10 changes: 5 additions & 5 deletions src/GitVersion.Configuration/BranchConfigurationBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ internal class BranchConfigurationBuilder
private HashSet<string> isSourceBranchFor = [];
private bool? tracksReleaseBranches;
private bool? isReleaseBranch;
private bool? isMainline;
private bool? isMainBranch;
private int? preReleaseWeight;

private BranchConfigurationBuilder()
Expand Down Expand Up @@ -116,9 +116,9 @@ public virtual BranchConfigurationBuilder WithIsReleaseBranch(bool? value)
return this;
}

public virtual BranchConfigurationBuilder WithIsMainline(bool? value)
public virtual BranchConfigurationBuilder WithIsMainBranch(bool? value)
{
this.isMainline = value;
this.isMainBranch = value;
return this;
}

Expand All @@ -141,7 +141,7 @@ public virtual BranchConfigurationBuilder WithConfiguration(IBranchConfiguration
WithRegularExpression(value.RegularExpression);
WithTracksReleaseBranches(value.TracksReleaseBranches);
WithIsReleaseBranch(value.IsReleaseBranch);
WithIsMainline(value.IsMainline);
WithIsMainBranch(value.IsMainBranch);
WithPreReleaseWeight(value.PreReleaseWeight);
WithSourceBranches(value.SourceBranches);
WithIsSourceBranchFor(value.IsSourceBranchFor);
Expand All @@ -158,7 +158,7 @@ public virtual BranchConfigurationBuilder WithConfiguration(IBranchConfiguration
TrackMergeTarget = trackMergeTarget,
TrackMergeMessage = trackMergeMessage,
CommitMessageIncrementing = commitMessageIncrementing,
IsMainline = isMainline,
IsMainBranch = isMainBranch,
IsReleaseBranch = isReleaseBranch,
LabelNumberPattern = labelNumberPattern,
PreventIncrementOfMergedBranchVersion = preventIncrementOfMergedBranchVersion,
Expand Down
10 changes: 5 additions & 5 deletions src/GitVersion.Configuration/ConfigurationBuilderBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ internal abstract class ConfigurationBuilderBase<TConfigurationBuilder> : IConfi
private string? regularExpression;
private bool? tracksReleaseBranches;
private bool? isReleaseBranch;
private bool? isMainline;
private bool? isMainBranch;
private int? preReleaseWeight;

protected readonly BranchMetaData MainBranch = new()
Expand Down Expand Up @@ -290,9 +290,9 @@ public virtual TConfigurationBuilder WithIsReleaseBranch(bool? value)
return (TConfigurationBuilder)this;
}

public virtual TConfigurationBuilder WithIsMainline(bool? value)
public virtual TConfigurationBuilder WithIsMainBranch(bool? value)
{
this.isMainline = value;
this.isMainBranch = value;
return (TConfigurationBuilder)this;
}

Expand Down Expand Up @@ -337,7 +337,7 @@ public virtual TConfigurationBuilder WithConfiguration(IGitVersionConfiguration
WithRegularExpression(value.RegularExpression);
WithTracksReleaseBranches(value.TracksReleaseBranches);
WithIsReleaseBranch(value.IsReleaseBranch);
WithIsMainline(value.IsMainline);
WithIsMainBranch(value.IsMainBranch);
WithPreReleaseWeight(value.PreReleaseWeight);
return (TConfigurationBuilder)this;
}
Expand Down Expand Up @@ -387,7 +387,7 @@ public virtual IGitVersionConfiguration Build()
TrackMergeTarget = this.trackMergeTarget,
TrackMergeMessage = this.trackMergeMessage,
CommitMessageIncrementing = this.commitMessageIncrementing,
IsMainline = this.isMainline,
IsMainBranch = this.isMainBranch,
IsReleaseBranch = this.isReleaseBranch,
LabelNumberPattern = this.labelNumberPattern,
PreventIncrementOfMergedBranchVersion = this.preventIncrementOfMergedBranchVersion,
Expand Down
8 changes: 4 additions & 4 deletions src/GitVersion.Configuration/ConfigurationFileLocator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,12 @@ bool HasConfigurationFileAt(string fileName, out string? configFile)

private static void VerifyReadConfig(IGitVersionConfiguration configuration)
{
// Verify no branches are set to mainline mode
if (configuration.Branches.Any(b => b.Value.VersioningMode == VersioningMode.Mainline))
// Verify no branches are set to TrunkBased mode
if (configuration.Branches.Any(b => b.Value.VersioningMode == VersioningMode.TrunkBased))
{
throw new ConfigurationException(@"Mainline mode only works at the repository level, a single branch cannot be put into mainline mode
throw new ConfigurationException(@"TrunkBased mode only works at the repository level, a single branch cannot be put into TrunkBased mode

This is because mainline mode treats your entire git repository as an event source with each merge into the 'mainline' incrementing the version.
This is because TrunkBased mode treats your entire git repository as an event source with each merge into the 'TrunkBased' incrementing the version.

If the docs do not help you decide on the mode open an issue to discuss what you are trying to do.");
}
Expand Down
Loading