-
Notifications
You must be signed in to change notification settings - Fork 654
Feature/replace the version mode mainline part i.a #3844
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
arturcic
merged 16 commits into
GitTools:main
from
HHobeck:feature/Replace-the-version-mode-Mainline-Part-I.A
Dec 19, 2023
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
9c2cfbd
Create TrunkBasedVersionStrategy implementation (see https://github.c…
HHobeck 14c1efc
Cretae TrunkBasedVersionStrategy implementation (see https://github.c…
HHobeck 4396e00
Fix Code Format warning
HHobeck 034e72a
Code format error CHARSET: Fix file encoding.
HHobeck 7042e5f
dotnet format ./src/ --exclude **/AddFormats/
HHobeck 20c3c2a
Remove TrunkBasedVersionCalculator and fix IsMatchForBranchSpecificLabel
HHobeck 39ac91c
Fix unit tests
HHobeck 10f9c60
Create integration tests for TrunkBasedVersionStrategy
HHobeck e945107
Support of TrackMergeTarget for the TrunkBased branching strategy.
HHobeck cbd9a2a
cleanup
arturcic eb5c989
Add entries to the PublicAPI.Unshipped.txt file
HHobeck d4ce0b6
remove TrunkBased Stretgy. Will be integrated later
HHobeck 9dcfc30
Integrate code review findings
HHobeck c8c04f3
Integrate code review suggestions
HHobeck f547042
Add a TODO to don't forget the consolidation of BaseVersionV2 and Bas…
HHobeck dcadb4a
change the calls to the CreateNextVersion and replace it with new Nex…
HHobeck File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1,380 changes: 1,380 additions & 0 deletions
1,380
src/GitVersion.Core.Tests/VersionCalculation/SemanticVersionTests.cs
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
using GitVersion.Configuration; | ||
using GitVersion.Extensions; | ||
|
||
namespace GitVersion.Core; | ||
|
||
internal sealed class BranchRepository : IBranchRepository | ||
{ | ||
private GitVersionContext VersionContext => this.versionContextLazy.Value; | ||
private readonly Lazy<GitVersionContext> versionContextLazy; | ||
|
||
private readonly IGitRepository gitRepository; | ||
|
||
public BranchRepository(Lazy<GitVersionContext> versionContext, IGitRepository gitRepository) | ||
{ | ||
this.versionContextLazy = versionContext.NotNull(); | ||
this.gitRepository = gitRepository.NotNull(); | ||
} | ||
|
||
public IEnumerable<IBranch> GetMainlineBranches(params IBranch[] excludeBranches) | ||
=> GetBranches(new HashSet<IBranch>(excludeBranches), configuration => configuration.IsMainline == true); | ||
|
||
public IEnumerable<IBranch> GetReleaseBranches(params IBranch[] excludeBranches) | ||
=> GetBranches(new HashSet<IBranch>(excludeBranches), configuration => configuration.IsReleaseBranch == true); | ||
|
||
private IEnumerable<IBranch> GetBranches(HashSet<IBranch> excludeBranches, Func<IBranchConfiguration, bool> predicate) | ||
{ | ||
predicate.NotNull(); | ||
|
||
foreach (var branch in this.gitRepository.Branches) | ||
{ | ||
if (!excludeBranches.Contains(branch)) | ||
{ | ||
var branchConfiguration = VersionContext.Configuration.GetBranchConfiguration(branch.Name); | ||
if (predicate(branchConfiguration)) | ||
{ | ||
yield return branch; | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
namespace GitVersion.Core; | ||
|
||
internal interface IBranchRepository | ||
{ | ||
IEnumerable<IBranch> GetMainlineBranches(params IBranch[] excludeBranches); | ||
|
||
IEnumerable<IBranch> GetReleaseBranches(params IBranch[] excludeBranches); | ||
} |
30 changes: 30 additions & 0 deletions
30
src/GitVersion.Core/Core/ITaggedSemanticVersionRepository.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
using GitVersion.Configuration; | ||
|
||
namespace GitVersion.Core; | ||
|
||
internal interface ITaggedSemanticVersionRepository | ||
{ | ||
ILookup<ICommit, SemanticVersionWithTag> GetTaggedSemanticVersions(IBranch branch, EffectiveConfiguration configuration); | ||
|
||
ILookup<ICommit, SemanticVersionWithTag> GetAllTaggedSemanticVersions(string? tagPrefix, SemanticVersionFormat format); | ||
|
||
ILookup<ICommit, SemanticVersionWithTag> GetTaggedSemanticVersionsOfBranch( | ||
IBranch branch, | ||
string? tagPrefix, | ||
SemanticVersionFormat format); | ||
|
||
ILookup<ICommit, SemanticVersionWithTag> GetTaggedSemanticVersionsOfMergeTarget( | ||
IBranch branch, | ||
string? tagPrefix, | ||
SemanticVersionFormat format); | ||
|
||
ILookup<ICommit, SemanticVersionWithTag> GetTaggedSemanticVersionsOfMainlineBranches( | ||
string? tagPrefix, | ||
SemanticVersionFormat format, | ||
params IBranch[] excludeBranches); | ||
|
||
ILookup<ICommit, SemanticVersionWithTag> GetTaggedSemanticVersionsOfReleaseBranches( | ||
string? tagPrefix, | ||
SemanticVersionFormat format, | ||
params IBranch[] excludeBranches); | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.