Skip to content

SemVer 2 support (take 2) #134

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
merged 2 commits into from
Mar 29, 2014
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
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"Minor":1,
"Patch":0,
"Suffix":"",
"LongVersion":"0.1.0 Sha:'000000000000000000000000000000000000000'",
"LongVersion":"0.1.0+Sha.000000000000000000000000000000000000000",
"NugetVersion":"0.1.0",
"ShortVersion":"0.1.0",
"BranchName":"master",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"Minor":2,
"Patch":0,
"Suffix":"",
"LongVersion":"0.2.0 Sha:'000000000000000000000000000000000000000'",
"LongVersion":"0.2.0+Sha.000000000000000000000000000000000000000",
"NugetVersion":"0.2.0",
"ShortVersion":"0.2.0",
"BranchName":"master",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"Minor":1,
"Patch":0,
"Suffix":"",
"LongVersion":"1.1.0 Sha:'000000000000000000000000000000000000000'",
"LongVersion":"1.1.0+Sha.000000000000000000000000000000000000000",
"NugetVersion":"1.1.0",
"ShortVersion":"1.1.0",
"BranchName":"master",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"Minor":1,
"Patch":0,
"Suffix":"",
"LongVersion":"1.1.0 Sha:'000000000000000000000000000000000000000'",
"LongVersion":"1.1.0+Sha.000000000000000000000000000000000000000",
"NugetVersion":"1.1.0",
"ShortVersion":"1.1.0",
"BranchName":"master",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"Minor":1,
"Patch":1,
"Suffix":"",
"LongVersion":"0.1.1 Sha:'000000000000000000000000000000000000000'",
"LongVersion":"0.1.1+Sha.000000000000000000000000000000000000000",
"NugetVersion":"0.1.1",
"ShortVersion":"0.1.1",
"BranchName":"master",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"Minor":0,
"Patch":4,
"Suffix":"",
"LongVersion":"1.0.4 Sha:'000000000000000000000000000000000000000'",
"LongVersion":"1.0.4+Sha.000000000000000000000000000000000000000",
"NugetVersion":"1.0.4",
"ShortVersion":"1.0.4",
"BranchName":"master",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"Minor":0,
"Patch":4,
"Suffix":"",
"LongVersion":"1.0.4 Sha:'000000000000000000000000000000000000000'",
"LongVersion":"1.0.4+Sha.000000000000000000000000000000000000000",
"NugetVersion":"1.0.4",
"ShortVersion":"1.0.4",
"BranchName":"master",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,31 +13,31 @@ public static string ToLongString(this VersionAndBranch versionAndBranch)
if (versionAndBranch.BranchType == BranchType.Feature)
{
var shortSha = versionAndBranch.Sha.Substring(0, 8);
return string.Format("{0}-unstable.feature-{1} Branch:'{2}' Sha:'{3}'", versionPrefix, shortSha, versionAndBranch.BranchName, versionAndBranch.Sha);
return string.Format("{0}-unstable.feature-{1}+Branch.{2}.Sha.{3}", versionPrefix, shortSha, versionAndBranch.BranchName, versionAndBranch.Sha);
}

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


if (versionAndBranch.BranchType == BranchType.Master)
{
return string.Format("{0} Sha:'{1}'", versionPrefix, versionAndBranch.Sha);
return string.Format("{0}+Sha.{1}", versionPrefix, versionAndBranch.Sha);
}


//else Hotfix, Develop or Release
if (releaseInformation.Stability == Stability.Final)
{
return string.Format("{0} Sha:'{1}'", versionPrefix, versionAndBranch.Sha);
return string.Format("{0}+Sha.{1}", versionPrefix, versionAndBranch.Sha);
}
if (releaseInformation.Stability == Stability.ReleaseCandidate)
{
return string.Format("{0}-rc{1} Branch:'{2}' Sha:'{3}'", versionPrefix, GetPreRelease(version.PreReleasePartTwo, releaseInformation), versionAndBranch.BranchName, versionAndBranch.Sha);
return string.Format("{0}-rc{1}+Branch.{2}.Sha.{3}", versionPrefix, GetPreRelease(version.PreReleasePartTwo, releaseInformation), versionAndBranch.BranchName, versionAndBranch.Sha);
}
return string.Format("{0}-{1}{2} Branch:'{3}' Sha:'{4}'", versionPrefix,releaseInformation.Stability.ToString().ToLowerInvariant(), GetPreRelease(version.PreReleasePartTwo, releaseInformation), versionAndBranch.BranchName, versionAndBranch.Sha);
return string.Format("{0}-{1}{2}+Branch.{3}.Sha.{4}", versionPrefix,releaseInformation.Stability.ToString().ToLowerInvariant(), GetPreRelease(version.PreReleasePartTwo, releaseInformation), versionAndBranch.BranchName, versionAndBranch.Sha);
}

static string GetPreRelease(int? preReleasePartTwo, ReleaseInformation releaseInformation)
Expand Down
4 changes: 2 additions & 2 deletions Tests/AssemblyInfoBuilderTests.VerifyCreatedCode.approved.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ using System.Reflection;

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

Expand Down Expand Up @@ -37,7 +37,7 @@ static class GitVersionInformation
{
public static string AssemblyVersion = "1.2.3";
public static string AssemblyFileVersion = "1.2.3";
public static string AssemblyInformationalVersion = "1.2.3-unstable.feature-a682956d Branch:'feature1' Sha:'a682956dc1a2752aa24597a0f5cd939f93614509'";
public static string AssemblyInformationalVersion = "1.2.3-unstable.feature-a682956d+Branch.feature1.Sha.a682956dc1a2752aa24597a0f5cd939f93614509";
public static string NugetVersion = "1.2.3-Feature-feature1-a682956dc1a2752aa24597a0f5cd939f93614509";
public static string SemVer = "1.2.3-Feature-feature1-a682956dc1a2752aa24597a0f5cd939f93614509";
}
Expand Down
2 changes: 1 addition & 1 deletion Tests/JsonVersionBuilderTests.Json.approved.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"Minor":2,
"Patch":3,
"Suffix":"a682956d",
"LongVersion":"1.2.3-unstable.feature-a682956d Branch:'feature1' Sha:'a682956dc1a2752aa24597a0f5cd939f93614509'",
"LongVersion":"1.2.3-unstable.feature-a682956d+Branch.feature1.Sha.a682956dc1a2752aa24597a0f5cd939f93614509",
"NugetVersion":"1.2.3-Feature-feature1-a682956dc1a2752aa24597a0f5cd939f93614509",
"ShortVersion":"1.2.3-unstable.feature-a682956d",
"BranchName":"feature1",
Expand Down
22 changes: 11 additions & 11 deletions Tests/OutputVariables/InformationalVersionBuilderTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@
[TestFixture]
public class InformationalVersionBuilderTests
{
[TestCase(BranchType.Feature, "feature1", "a682956dc1a2752aa24597a0f5cd939f93614509", 1, 2, 3, "unstable", "a682956d", "1.2.3-unstable.feature-a682956d Branch:'feature1' Sha:'a682956dc1a2752aa24597a0f5cd939f93614509'")]
[TestCase(BranchType.Develop, "develop", "a682956dc1a2752aa24597a0f5cd939f93614509", 1, 2, 3, "alpha645", null, "1.2.3-alpha645 Branch:'develop' Sha:'a682956dc1a2752aa24597a0f5cd939f93614509'")]
[TestCase(BranchType.Develop, "develop", "a682956dc1a2752aa24597a0f5cd939f93614509", 1, 2, 3, "unstable645", null, "1.2.3-unstable645 Branch:'develop' Sha:'a682956dc1a2752aa24597a0f5cd939f93614509'")]
[TestCase(BranchType.Develop, "develop", "a682956dc1a2752aa24597a0f5cd939f93614509", 1, 2, 3, "beta645", null, "1.2.3-beta645 Branch:'develop' Sha:'a682956dc1a2752aa24597a0f5cd939f93614509'")]
[TestCase(BranchType.Hotfix, "hotfix-foo", "a682956dc1a2752aa24597a0f5cd939f93614509", 1, 2, 3, "alpha645", null, "1.2.3-alpha645 Branch:'hotfix-foo' Sha:'a682956dc1a2752aa24597a0f5cd939f93614509'")]
[TestCase(BranchType.Hotfix, "hotfix-foo", "a682956dc1a2752aa24597a0f5cd939f93614509", 1, 2, 3, "beta645", null, "1.2.3-beta645 Branch:'hotfix-foo' Sha:'a682956dc1a2752aa24597a0f5cd939f93614509'")]
[TestCase(BranchType.Hotfix, "hotfix-foo", "a682956dc1a2752aa24597a0f5cd939f93614509", 1, 2, 3, null, null, "1.2.3 Sha:'a682956dc1a2752aa24597a0f5cd939f93614509'")]
[TestCase(BranchType.Master, "master", "a682956dc1a2752aa24597a0f5cd939f93614509", 1, 2, 3, null, null, "1.2.3 Sha:'a682956dc1a2752aa24597a0f5cd939f93614509'")]
[TestCase(BranchType.PullRequest, "myPullRequest", "a682956dc1a2752aa24597a0f5cd939f93614509", 1, 2, 3, "unstable3", null, "1.2.3-unstable.pull-request-3 Branch:'myPullRequest' Sha:'a682956dc1a2752aa24597a0f5cd939f93614509'")]
[TestCase(BranchType.Release, "release-1.2", "a682956dc1a2752aa24597a0f5cd939f93614509", 1, 2, 0, "beta2", null, "1.2.0-beta2 Branch:'release-1.2' Sha:'a682956dc1a2752aa24597a0f5cd939f93614509'")]
[TestCase(BranchType.Release, "release-1.2", "a682956dc1a2752aa24597a0f5cd939f93614509", 1, 2, 0, "alpha2", null, "1.2.0-alpha2 Branch:'release-1.2' Sha:'a682956dc1a2752aa24597a0f5cd939f93614509'")]
[TestCase(BranchType.Feature, "feature1", "a682956dc1a2752aa24597a0f5cd939f93614509", 1, 2, 3, "unstable", "a682956d", "1.2.3-unstable.feature-a682956d+Branch.feature1.Sha.a682956dc1a2752aa24597a0f5cd939f93614509")]
[TestCase(BranchType.Develop, "develop", "a682956dc1a2752aa24597a0f5cd939f93614509", 1, 2, 3, "alpha645", null, "1.2.3-alpha645+Branch.develop.Sha.a682956dc1a2752aa24597a0f5cd939f93614509")]
[TestCase(BranchType.Develop, "develop", "a682956dc1a2752aa24597a0f5cd939f93614509", 1, 2, 3, "unstable645", null, "1.2.3-unstable645+Branch.develop.Sha.a682956dc1a2752aa24597a0f5cd939f93614509")]
[TestCase(BranchType.Develop, "develop", "a682956dc1a2752aa24597a0f5cd939f93614509", 1, 2, 3, "beta645", null, "1.2.3-beta645+Branch.develop.Sha.a682956dc1a2752aa24597a0f5cd939f93614509")]
[TestCase(BranchType.Hotfix, "hotfix-foo", "a682956dc1a2752aa24597a0f5cd939f93614509", 1, 2, 3, "alpha645", null, "1.2.3-alpha645+Branch.hotfix-foo.Sha.a682956dc1a2752aa24597a0f5cd939f93614509")]
[TestCase(BranchType.Hotfix, "hotfix-foo", "a682956dc1a2752aa24597a0f5cd939f93614509", 1, 2, 3, "beta645", null, "1.2.3-beta645+Branch.hotfix-foo.Sha.a682956dc1a2752aa24597a0f5cd939f93614509")]
[TestCase(BranchType.Hotfix, "hotfix-foo", "a682956dc1a2752aa24597a0f5cd939f93614509", 1, 2, 3, null, null, "1.2.3+Sha.a682956dc1a2752aa24597a0f5cd939f93614509")]
[TestCase(BranchType.Master, "master", "a682956dc1a2752aa24597a0f5cd939f93614509", 1, 2, 3, null, null, "1.2.3+Sha.a682956dc1a2752aa24597a0f5cd939f93614509")]
[TestCase(BranchType.PullRequest, "myPullRequest", "a682956dc1a2752aa24597a0f5cd939f93614509", 1, 2, 3, "unstable3", null, "1.2.3-unstable.pull-request-3+Branch.myPullRequest.Sha.a682956dc1a2752aa24597a0f5cd939f93614509")]
[TestCase(BranchType.Release, "release-1.2", "a682956dc1a2752aa24597a0f5cd939f93614509", 1, 2, 0, "beta2", null, "1.2.0-beta2+Branch.release-1.2.Sha.a682956dc1a2752aa24597a0f5cd939f93614509")]
[TestCase(BranchType.Release, "release-1.2", "a682956dc1a2752aa24597a0f5cd939f93614509", 1, 2, 0, "alpha2", null, "1.2.0-alpha2+Branch.release-1.2.Sha.a682956dc1a2752aa24597a0f5cd939f93614509")]
public void ValidateInformationalVersionBuilder(BranchType branchType, string branchName, string sha, int major, int minor, int patch,
string tag, string suffix, string versionString)
{
Expand Down