Skip to content

Commit

Permalink
GHF version now uses tag of current commit
Browse files Browse the repository at this point in the history
  • Loading branch information
distantcam committed Jun 10, 2014
1 parent 24ded03 commit dd63885
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 14 deletions.
7 changes: 2 additions & 5 deletions AcceptanceTests/MsBuildProjectArgTest.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@


namespace GitHubFlowVersion.AcceptanceTests
namespace GitHubFlowVersion.AcceptanceTests
{
using System.IO;
using global::AcceptanceTests;
Expand All @@ -11,7 +9,6 @@ namespace GitHubFlowVersion.AcceptanceTests

public class MsBuildProjectArgTest
{

[Fact]
public void RunsMsBuildProvideViaCommandLineArg()
{
Expand All @@ -25,7 +22,7 @@ public void RunsMsBuildProvideViaCommandLineArg()
var result = GitVersionHelper.ExecuteIn(fixture.RepositoryPath, projectFile: "TestBuildFile.proj", projectArgs: "/target:OutputResults");

result.ExitCode.ShouldBe(0);
result.Log.ShouldContain("FullSemVer: 1.2.4+0");
result.Log.ShouldContain("FullSemVer: 1.2.3+0");
}
}
}
Expand Down
19 changes: 12 additions & 7 deletions GitVersionCore/GitHubFlow/NextSemverCalculator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,30 +25,35 @@ public NextSemverCalculator(
public SemanticVersion NextVersion()
{
var versionZero = new SemanticVersion();
var lastRelease = lastTaggedReleaseFinder.GetVersion().SemVer;
var lastRelease = lastTaggedReleaseFinder.GetVersion();
var fileVersion = nextVersionTxtFileFinder.GetNextVersion();
var mergedBranchVersion = mergedBranchesWithVersionFinder.GetVersion();
var otherBranchVersion = unknownBranchFinder.FindVersion(context);
if (otherBranchVersion != null && otherBranchVersion.PreReleaseTag != null && otherBranchVersion.PreReleaseTag.Name == "release")
otherBranchVersion.PreReleaseTag.Name = "beta";

var maxCalculated = new[]{ fileVersion, otherBranchVersion, mergedBranchVersion }.Max();
var maxCalculated = new[] { fileVersion, otherBranchVersion, mergedBranchVersion }.Max();

if (lastRelease == versionZero && maxCalculated == versionZero)
if (lastRelease.SemVer == versionZero && maxCalculated == versionZero)
{
return new SemanticVersion
{
Minor = 1
};
}

if (maxCalculated <= lastRelease)
if (string.Equals(context.CurrentCommit.Sha, lastRelease.Commit.Sha))
{
return lastRelease.SemVer;
}

if (maxCalculated <= lastRelease.SemVer)
{
return new SemanticVersion
{
Major = lastRelease.Major,
Minor = lastRelease.Minor,
Patch = lastRelease.Patch + 1
Major = lastRelease.SemVer.Major,
Minor = lastRelease.SemVer.Minor,
Patch = lastRelease.SemVer.Patch + 1
};
}

Expand Down
3 changes: 1 addition & 2 deletions GitVersionCore/GitVersionCore.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="Visualize">
<HintPath>..\packages\Visualize.Fody.0.3.0.0\Lib\portable-net4+sl4+wp7+win8+MonoAndroid16+MonoTouch40\Visualize.dll</HintPath>
<Private>False</Private>
<HintPath>..\packages\Visualize.Fody.0.4.0.0\Lib\portable-net4+sl4+wp7+win8+MonoAndroid16+MonoTouch40\Visualize.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
Expand Down

0 comments on commit dd63885

Please sign in to comment.