@@ -29,14 +29,12 @@ public IEnumerable<BaseVersion> GetBaseVersions(EffectiveBranchConfiguration con
2929 if ( ! Context . Configuration . VersionStrategy . HasFlag ( VersionStrategies . TrackReleaseBranches ) )
3030 yield break ;
3131
32- if ( configuration . Value . TracksReleaseBranches )
32+ if ( ! configuration . Value . TracksReleaseBranches ) yield break ;
33+ foreach ( var releaseBranch in this . branchRepository . GetReleaseBranches ( Context . Configuration ) )
3334 {
34- foreach ( var releaseBranche in branchRepository . GetReleaseBranches ( Context . Configuration ) )
35+ if ( TryGetBaseVersion ( releaseBranch , configuration , out var baseVersion ) )
3536 {
36- if ( TryGetBaseVersion ( releaseBranche , configuration , out var baseVersion ) )
37- {
38- yield return baseVersion ;
39- }
37+ yield return baseVersion ;
4038 }
4139 }
4240 }
@@ -47,31 +45,29 @@ private bool TryGetBaseVersion(
4745 result = null ;
4846
4947 var releaseBranchConfiguration = Context . Configuration . GetEffectiveBranchConfiguration ( releaseBranch ) ;
50- if ( this . releaseVersionStrategy . TryGetBaseVersion ( releaseBranchConfiguration , out var baseVersion ) )
51- {
52- // Find the commit where the child branch was created.
53- var baseVersionSource = this . repositoryStore . FindMergeBase ( releaseBranch , Context . CurrentBranch ) ;
54- var label = configuration . Value . GetBranchSpecificLabel ( Context . CurrentBranch . Name , null ) ;
55- var increment = incrementStrategyFinder . DetermineIncrementedField (
56- currentCommit : Context . CurrentCommit ,
57- baseVersionSource : baseVersionSource ,
58- shouldIncrement : true ,
59- configuration : configuration . Value ,
60- label : label
61- ) ;
48+ if ( ! this . releaseVersionStrategy . TryGetBaseVersion ( releaseBranchConfiguration , out var baseVersion ) ) return result is not null ;
49+ // Find the commit where the child branch was created.
50+ var baseVersionSource = this . repositoryStore . FindMergeBase ( releaseBranch , Context . CurrentBranch ) ;
51+ var label = configuration . Value . GetBranchSpecificLabel ( Context . CurrentBranch . Name , null ) ;
52+ var increment = this . incrementStrategyFinder . DetermineIncrementedField (
53+ currentCommit : Context . CurrentCommit ,
54+ baseVersionSource : baseVersionSource ,
55+ shouldIncrement : true ,
56+ configuration : configuration . Value ,
57+ label : label
58+ ) ;
6259
63- result = new BaseVersion (
64- "Release branch exists -> " + baseVersion . Source , baseVersion . SemanticVersion , baseVersionSource )
60+ result = new BaseVersion (
61+ "Release branch exists -> " + baseVersion . Source , baseVersion . SemanticVersion , baseVersionSource )
62+ {
63+ Operator = new BaseVersionOperator
6564 {
66- Operator = new BaseVersionOperator
67- {
68- Increment = increment ,
69- ForceIncrement = false ,
70- Label = label
71- }
72- } ;
73- }
65+ Increment = increment ,
66+ ForceIncrement = false ,
67+ Label = label
68+ }
69+ } ;
7470
75- return result is not null ;
71+ return true ;
7672 }
7773}
0 commit comments