@@ -14,7 +14,8 @@ public class NextVersionCalculator : INextVersionCalculator
14
14
private readonly IRepositoryStore repositoryStore ;
15
15
private readonly IIncrementStrategyFinder incrementStrategyFinder ;
16
16
private readonly Lazy < GitVersionContext > versionContext ;
17
- private GitVersionContext context => this . versionContext . Value ;
17
+
18
+ private GitVersionContext Context => this . versionContext . Value ;
18
19
19
20
public NextVersionCalculator (
20
21
ILog log ,
@@ -34,32 +35,32 @@ public NextVersionCalculator(
34
35
35
36
public NextVersion FindVersion ( )
36
37
{
37
- this . log . Info ( $ "Running against branch: { context . CurrentBranch } ({ context . CurrentCommit ? . ToString ( ) ?? "-" } )") ;
38
- if ( context . IsCurrentCommitTagged )
38
+ this . log . Info ( $ "Running against branch: { Context . CurrentBranch } ({ Context . CurrentCommit ? . ToString ( ) ?? "-" } )") ;
39
+ if ( Context . IsCurrentCommitTagged )
39
40
{
40
- this . log . Info ( $ "Current commit is tagged with version { context . CurrentCommitTaggedVersion } , " + "version calculation is for metadata only." ) ;
41
+ this . log . Info ( $ "Current commit is tagged with version { Context . CurrentCommitTaggedVersion } , " + "version calculation is for metadata only." ) ;
41
42
}
42
43
else
43
44
{
44
- EnsureHeadIsNotDetached ( context ) ;
45
+ EnsureHeadIsNotDetached ( Context ) ;
45
46
}
46
47
47
48
SemanticVersion ? taggedSemanticVersion = null ;
48
49
49
- if ( context . IsCurrentCommitTagged )
50
+ if ( Context . IsCurrentCommitTagged )
50
51
{
51
52
// Will always be 0, don't bother with the +0 on tags
52
- var semanticVersionBuildMetaData = this . mainlineVersionCalculator . CreateVersionBuildMetaData ( context . CurrentCommit ) ;
53
+ var semanticVersionBuildMetaData = this . mainlineVersionCalculator . CreateVersionBuildMetaData ( Context . CurrentCommit ) ;
53
54
semanticVersionBuildMetaData . CommitsSinceTag = null ;
54
55
55
- var semanticVersion = new SemanticVersion ( context . CurrentCommitTaggedVersion ) { BuildMetaData = semanticVersionBuildMetaData } ;
56
+ var semanticVersion = new SemanticVersion ( Context . CurrentCommitTaggedVersion ) { BuildMetaData = semanticVersionBuildMetaData } ;
56
57
taggedSemanticVersion = semanticVersion ;
57
58
}
58
59
59
60
var ( baseVersion , configuration ) = this . baseVersionCalculator . GetBaseVersion ( ) ;
60
61
baseVersion . SemanticVersion . BuildMetaData = this . mainlineVersionCalculator . CreateVersionBuildMetaData ( baseVersion . BaseVersionSource ) ;
61
62
SemanticVersion semver ;
62
- if ( context . FullConfiguration . VersioningMode == VersioningMode . Mainline )
63
+ if ( Context . FullConfiguration . VersioningMode == VersioningMode . Mainline )
63
64
{
64
65
semver = this . mainlineVersionCalculator . FindMainlineModeVersion ( baseVersion ) ;
65
66
}
@@ -106,19 +107,19 @@ public NextVersion FindVersion()
106
107
private SemanticVersion PerformIncrement ( BaseVersion baseVersion , EffectiveConfiguration configuration )
107
108
{
108
109
var semver = baseVersion . SemanticVersion ;
109
- var increment = this . incrementStrategyFinder . DetermineIncrementedField ( context , baseVersion , configuration ) ;
110
+ var increment = this . incrementStrategyFinder . DetermineIncrementedField ( Context , baseVersion , configuration ) ;
110
111
semver = semver . IncrementVersion ( increment ) ;
111
112
return semver ;
112
113
}
113
114
114
115
private void UpdatePreReleaseTag ( EffectiveConfiguration configuration , SemanticVersion semanticVersion , string ? branchNameOverride )
115
116
{
116
- var tagToUse = configuration . GetBranchSpecificTag ( this . log , context . CurrentBranch . Name . Friendly , branchNameOverride ) ;
117
+ var tagToUse = configuration . GetBranchSpecificTag ( this . log , Context . CurrentBranch . Name . Friendly , branchNameOverride ) ;
117
118
118
119
long ? number = null ;
119
120
120
121
var lastTag = this . repositoryStore
121
- . GetVersionTagsOnBranch ( context . CurrentBranch , context . FullConfiguration . TagPrefix )
122
+ . GetVersionTagsOnBranch ( Context . CurrentBranch , Context . FullConfiguration . TagPrefix )
122
123
. FirstOrDefault ( v => v . PreReleaseTag ? . Name ? . IsEquivalentTo ( tagToUse ) == true ) ;
123
124
124
125
if ( lastTag != null && MajorMinorPatchEqual ( lastTag , semanticVersion ) && lastTag . PreReleaseTag ? . HasTag ( ) == true )
0 commit comments