Skip to content

Commit bc68714

Browse files
committed
Merge pull request #134 from distantcam/semver20
SemVer 2 support (take 2)
2 parents 39153d3 + 8d8964b commit bc68714

11 files changed

+27
-27
lines changed

AcceptanceTests/NoTagsInRepositorySpecification.RunSpecification.approved.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"Minor":1,
44
"Patch":0,
55
"Suffix":"",
6-
"LongVersion":"0.1.0 Sha:'000000000000000000000000000000000000000'",
6+
"LongVersion":"0.1.0+Sha.000000000000000000000000000000000000000",
77
"NugetVersion":"0.1.0",
88
"ShortVersion":"0.1.0",
99
"BranchName":"master",

AcceptanceTests/NoTagsInRepositoryWithNextVersionTxtSpecification.RunSpecification.approved.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"Minor":2,
44
"Patch":0,
55
"Suffix":"",
6-
"LongVersion":"0.2.0 Sha:'000000000000000000000000000000000000000'",
6+
"LongVersion":"0.2.0+Sha.000000000000000000000000000000000000000",
77
"NugetVersion":"0.2.0",
88
"ShortVersion":"0.2.0",
99
"BranchName":"master",

AcceptanceTests/TagFollowedByCommitsWithApplicableNextVersionTxtSpecification.ForOneCommit.approved.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"Minor":1,
44
"Patch":0,
55
"Suffix":"",
6-
"LongVersion":"1.1.0 Sha:'000000000000000000000000000000000000000'",
6+
"LongVersion":"1.1.0+Sha.000000000000000000000000000000000000000",
77
"NugetVersion":"1.1.0",
88
"ShortVersion":"1.1.0",
99
"BranchName":"master",

AcceptanceTests/TagFollowedByCommitsWithApplicableNextVersionTxtSpecification.ForTenCommitsCommit.approved.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"Minor":1,
44
"Patch":0,
55
"Suffix":"",
6-
"LongVersion":"1.1.0 Sha:'000000000000000000000000000000000000000'",
6+
"LongVersion":"1.1.0+Sha.000000000000000000000000000000000000000",
77
"NugetVersion":"1.1.0",
88
"ShortVersion":"1.1.0",
99
"BranchName":"master",

AcceptanceTests/TagFollowedByCommitsWithNoNextVersionTxtSpecification.RunSpecification.approved.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"Minor":1,
44
"Patch":1,
55
"Suffix":"",
6-
"LongVersion":"0.1.1 Sha:'000000000000000000000000000000000000000'",
6+
"LongVersion":"0.1.1+Sha.000000000000000000000000000000000000000",
77
"NugetVersion":"0.1.1",
88
"ShortVersion":"0.1.1",
99
"BranchName":"master",

AcceptanceTests/TagFollowedByCommitsWithRedundantNextVersionTxtSpecification.WithOneCommit.approved.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"Minor":0,
44
"Patch":4,
55
"Suffix":"",
6-
"LongVersion":"1.0.4 Sha:'000000000000000000000000000000000000000'",
6+
"LongVersion":"1.0.4+Sha.000000000000000000000000000000000000000",
77
"NugetVersion":"1.0.4",
88
"ShortVersion":"1.0.4",
99
"BranchName":"master",

AcceptanceTests/TagFollowedByCommitsWithRedundantNextVersionTxtSpecification.WithTenCommit.approved.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"Minor":0,
44
"Patch":4,
55
"Suffix":"",
6-
"LongVersion":"1.0.4 Sha:'000000000000000000000000000000000000000'",
6+
"LongVersion":"1.0.4+Sha.000000000000000000000000000000000000000",
77
"NugetVersion":"1.0.4",
88
"ShortVersion":"1.0.4",
99
"BranchName":"master",

GitVersion/OutputVariables/VersionBuilders/InformationalVersionBuilder.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,31 +13,31 @@ public static string ToLongString(this VersionAndBranch versionAndBranch)
1313
if (versionAndBranch.BranchType == BranchType.Feature)
1414
{
1515
var shortSha = versionAndBranch.Sha.Substring(0, 8);
16-
return string.Format("{0}-unstable.feature-{1} Branch:'{2}' Sha:'{3}'", versionPrefix, shortSha, versionAndBranch.BranchName, versionAndBranch.Sha);
16+
return string.Format("{0}-unstable.feature-{1}+Branch.{2}.Sha.{3}", versionPrefix, shortSha, versionAndBranch.BranchName, versionAndBranch.Sha);
1717
}
1818

1919
if (versionAndBranch.BranchType == BranchType.PullRequest)
2020
{
21-
return string.Format("{0}-unstable.pull-request-{1} Branch:'{2}' Sha:'{3}'", versionPrefix, GetPreRelease(version.PreReleasePartTwo, releaseInformation), versionAndBranch.BranchName, versionAndBranch.Sha);
21+
return string.Format("{0}-unstable.pull-request-{1}+Branch.{2}.Sha.{3}", versionPrefix, GetPreRelease(version.PreReleasePartTwo, releaseInformation), versionAndBranch.BranchName, versionAndBranch.Sha);
2222
}
2323

2424

2525
if (versionAndBranch.BranchType == BranchType.Master)
2626
{
27-
return string.Format("{0} Sha:'{1}'", versionPrefix, versionAndBranch.Sha);
27+
return string.Format("{0}+Sha.{1}", versionPrefix, versionAndBranch.Sha);
2828
}
2929

3030

3131
//else Hotfix, Develop or Release
3232
if (releaseInformation.Stability == Stability.Final)
3333
{
34-
return string.Format("{0} Sha:'{1}'", versionPrefix, versionAndBranch.Sha);
34+
return string.Format("{0}+Sha.{1}", versionPrefix, versionAndBranch.Sha);
3535
}
3636
if (releaseInformation.Stability == Stability.ReleaseCandidate)
3737
{
38-
return string.Format("{0}-rc{1} Branch:'{2}' Sha:'{3}'", versionPrefix, GetPreRelease(version.PreReleasePartTwo, releaseInformation), versionAndBranch.BranchName, versionAndBranch.Sha);
38+
return string.Format("{0}-rc{1}+Branch.{2}.Sha.{3}", versionPrefix, GetPreRelease(version.PreReleasePartTwo, releaseInformation), versionAndBranch.BranchName, versionAndBranch.Sha);
3939
}
40-
return string.Format("{0}-{1}{2} Branch:'{3}' Sha:'{4}'", versionPrefix,releaseInformation.Stability.ToString().ToLowerInvariant(), GetPreRelease(version.PreReleasePartTwo, releaseInformation), versionAndBranch.BranchName, versionAndBranch.Sha);
40+
return string.Format("{0}-{1}{2}+Branch.{3}.Sha.{4}", versionPrefix,releaseInformation.Stability.ToString().ToLowerInvariant(), GetPreRelease(version.PreReleasePartTwo, releaseInformation), versionAndBranch.BranchName, versionAndBranch.Sha);
4141
}
4242

4343
static string GetPreRelease(int? preReleasePartTwo, ReleaseInformation releaseInformation)

Tests/AssemblyInfoBuilderTests.VerifyCreatedCode.approved.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ using System.Reflection;
44

55
[assembly: AssemblyVersion("1.2.3")]
66
[assembly: AssemblyFileVersion("1.2.3")]
7-
[assembly: AssemblyInformationalVersion("1.2.3-unstable.feature-a682956d Branch:'feature1' Sha:'a682956dc1a2752aa24597a0f5cd939f93614509'")]
7+
[assembly: AssemblyInformationalVersion("1.2.3-unstable.feature-a682956d+Branch.feature1.Sha.a682956dc1a2752aa24597a0f5cd939f93614509")]
88
[assembly: NugetVersion("1.2.3-Feature-feature1-a682956dc1a2752aa24597a0f5cd939f93614509")]
99
[assembly: ReleaseDate("2014-03-01", "2014-03-06")]
1010

@@ -37,7 +37,7 @@ static class GitVersionInformation
3737
{
3838
public static string AssemblyVersion = "1.2.3";
3939
public static string AssemblyFileVersion = "1.2.3";
40-
public static string AssemblyInformationalVersion = "1.2.3-unstable.feature-a682956d Branch:'feature1' Sha:'a682956dc1a2752aa24597a0f5cd939f93614509'";
40+
public static string AssemblyInformationalVersion = "1.2.3-unstable.feature-a682956d+Branch.feature1.Sha.a682956dc1a2752aa24597a0f5cd939f93614509";
4141
public static string NugetVersion = "1.2.3-Feature-feature1-a682956dc1a2752aa24597a0f5cd939f93614509";
4242
public static string SemVer = "1.2.3-Feature-feature1-a682956dc1a2752aa24597a0f5cd939f93614509";
4343
}

Tests/JsonVersionBuilderTests.Json.approved.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"Minor":2,
44
"Patch":3,
55
"Suffix":"a682956d",
6-
"LongVersion":"1.2.3-unstable.feature-a682956d Branch:'feature1' Sha:'a682956dc1a2752aa24597a0f5cd939f93614509'",
6+
"LongVersion":"1.2.3-unstable.feature-a682956d+Branch.feature1.Sha.a682956dc1a2752aa24597a0f5cd939f93614509",
77
"NugetVersion":"1.2.3-Feature-feature1-a682956dc1a2752aa24597a0f5cd939f93614509",
88
"ShortVersion":"1.2.3-unstable.feature-a682956d",
99
"BranchName":"feature1",

Tests/OutputVariables/InformationalVersionBuilderTests.cs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@
44
[TestFixture]
55
public class InformationalVersionBuilderTests
66
{
7-
[TestCase(BranchType.Feature, "feature1", "a682956dc1a2752aa24597a0f5cd939f93614509", 1, 2, 3, "unstable", "a682956d", "1.2.3-unstable.feature-a682956d Branch:'feature1' Sha:'a682956dc1a2752aa24597a0f5cd939f93614509'")]
8-
[TestCase(BranchType.Develop, "develop", "a682956dc1a2752aa24597a0f5cd939f93614509", 1, 2, 3, "alpha645", null, "1.2.3-alpha645 Branch:'develop' Sha:'a682956dc1a2752aa24597a0f5cd939f93614509'")]
9-
[TestCase(BranchType.Develop, "develop", "a682956dc1a2752aa24597a0f5cd939f93614509", 1, 2, 3, "unstable645", null, "1.2.3-unstable645 Branch:'develop' Sha:'a682956dc1a2752aa24597a0f5cd939f93614509'")]
10-
[TestCase(BranchType.Develop, "develop", "a682956dc1a2752aa24597a0f5cd939f93614509", 1, 2, 3, "beta645", null, "1.2.3-beta645 Branch:'develop' Sha:'a682956dc1a2752aa24597a0f5cd939f93614509'")]
11-
[TestCase(BranchType.Hotfix, "hotfix-foo", "a682956dc1a2752aa24597a0f5cd939f93614509", 1, 2, 3, "alpha645", null, "1.2.3-alpha645 Branch:'hotfix-foo' Sha:'a682956dc1a2752aa24597a0f5cd939f93614509'")]
12-
[TestCase(BranchType.Hotfix, "hotfix-foo", "a682956dc1a2752aa24597a0f5cd939f93614509", 1, 2, 3, "beta645", null, "1.2.3-beta645 Branch:'hotfix-foo' Sha:'a682956dc1a2752aa24597a0f5cd939f93614509'")]
13-
[TestCase(BranchType.Hotfix, "hotfix-foo", "a682956dc1a2752aa24597a0f5cd939f93614509", 1, 2, 3, null, null, "1.2.3 Sha:'a682956dc1a2752aa24597a0f5cd939f93614509'")]
14-
[TestCase(BranchType.Master, "master", "a682956dc1a2752aa24597a0f5cd939f93614509", 1, 2, 3, null, null, "1.2.3 Sha:'a682956dc1a2752aa24597a0f5cd939f93614509'")]
15-
[TestCase(BranchType.PullRequest, "myPullRequest", "a682956dc1a2752aa24597a0f5cd939f93614509", 1, 2, 3, "unstable3", null, "1.2.3-unstable.pull-request-3 Branch:'myPullRequest' Sha:'a682956dc1a2752aa24597a0f5cd939f93614509'")]
16-
[TestCase(BranchType.Release, "release-1.2", "a682956dc1a2752aa24597a0f5cd939f93614509", 1, 2, 0, "beta2", null, "1.2.0-beta2 Branch:'release-1.2' Sha:'a682956dc1a2752aa24597a0f5cd939f93614509'")]
17-
[TestCase(BranchType.Release, "release-1.2", "a682956dc1a2752aa24597a0f5cd939f93614509", 1, 2, 0, "alpha2", null, "1.2.0-alpha2 Branch:'release-1.2' Sha:'a682956dc1a2752aa24597a0f5cd939f93614509'")]
7+
[TestCase(BranchType.Feature, "feature1", "a682956dc1a2752aa24597a0f5cd939f93614509", 1, 2, 3, "unstable", "a682956d", "1.2.3-unstable.feature-a682956d+Branch.feature1.Sha.a682956dc1a2752aa24597a0f5cd939f93614509")]
8+
[TestCase(BranchType.Develop, "develop", "a682956dc1a2752aa24597a0f5cd939f93614509", 1, 2, 3, "alpha645", null, "1.2.3-alpha645+Branch.develop.Sha.a682956dc1a2752aa24597a0f5cd939f93614509")]
9+
[TestCase(BranchType.Develop, "develop", "a682956dc1a2752aa24597a0f5cd939f93614509", 1, 2, 3, "unstable645", null, "1.2.3-unstable645+Branch.develop.Sha.a682956dc1a2752aa24597a0f5cd939f93614509")]
10+
[TestCase(BranchType.Develop, "develop", "a682956dc1a2752aa24597a0f5cd939f93614509", 1, 2, 3, "beta645", null, "1.2.3-beta645+Branch.develop.Sha.a682956dc1a2752aa24597a0f5cd939f93614509")]
11+
[TestCase(BranchType.Hotfix, "hotfix-foo", "a682956dc1a2752aa24597a0f5cd939f93614509", 1, 2, 3, "alpha645", null, "1.2.3-alpha645+Branch.hotfix-foo.Sha.a682956dc1a2752aa24597a0f5cd939f93614509")]
12+
[TestCase(BranchType.Hotfix, "hotfix-foo", "a682956dc1a2752aa24597a0f5cd939f93614509", 1, 2, 3, "beta645", null, "1.2.3-beta645+Branch.hotfix-foo.Sha.a682956dc1a2752aa24597a0f5cd939f93614509")]
13+
[TestCase(BranchType.Hotfix, "hotfix-foo", "a682956dc1a2752aa24597a0f5cd939f93614509", 1, 2, 3, null, null, "1.2.3+Sha.a682956dc1a2752aa24597a0f5cd939f93614509")]
14+
[TestCase(BranchType.Master, "master", "a682956dc1a2752aa24597a0f5cd939f93614509", 1, 2, 3, null, null, "1.2.3+Sha.a682956dc1a2752aa24597a0f5cd939f93614509")]
15+
[TestCase(BranchType.PullRequest, "myPullRequest", "a682956dc1a2752aa24597a0f5cd939f93614509", 1, 2, 3, "unstable3", null, "1.2.3-unstable.pull-request-3+Branch.myPullRequest.Sha.a682956dc1a2752aa24597a0f5cd939f93614509")]
16+
[TestCase(BranchType.Release, "release-1.2", "a682956dc1a2752aa24597a0f5cd939f93614509", 1, 2, 0, "beta2", null, "1.2.0-beta2+Branch.release-1.2.Sha.a682956dc1a2752aa24597a0f5cd939f93614509")]
17+
[TestCase(BranchType.Release, "release-1.2", "a682956dc1a2752aa24597a0f5cd939f93614509", 1, 2, 0, "alpha2", null, "1.2.0-alpha2+Branch.release-1.2.Sha.a682956dc1a2752aa24597a0f5cd939f93614509")]
1818
public void ValidateInformationalVersionBuilder(BranchType branchType, string branchName, string sha, int major, int minor, int patch,
1919
string tag, string suffix, string versionString)
2020
{

0 commit comments

Comments
 (0)