Skip to content

Cleanup #362

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
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
18 changes: 2 additions & 16 deletions GitVersion.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.30723.0
# Visual Studio 14
VisualStudioVersion = 14.0.22512.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GitVersionExe", "GitVersionExe\GitVersionExe.csproj", "{C3578A7B-09A6-4444-9383-0DEAFA4958BD}"
EndProject
Expand All @@ -26,47 +26,33 @@ EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{C3578A7B-09A6-4444-9383-0DEAFA4958BD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C3578A7B-09A6-4444-9383-0DEAFA4958BD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C3578A7B-09A6-4444-9383-0DEAFA4958BD}.Debug|x86.ActiveCfg = Debug|Any CPU
{C3578A7B-09A6-4444-9383-0DEAFA4958BD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C3578A7B-09A6-4444-9383-0DEAFA4958BD}.Release|Any CPU.Build.0 = Release|Any CPU
{C3578A7B-09A6-4444-9383-0DEAFA4958BD}.Release|x86.ActiveCfg = Release|Any CPU
{5A86453B-96FB-4B6E-A283-225BB9F753D3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5A86453B-96FB-4B6E-A283-225BB9F753D3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5A86453B-96FB-4B6E-A283-225BB9F753D3}.Debug|x86.ActiveCfg = Debug|Any CPU
{5A86453B-96FB-4B6E-A283-225BB9F753D3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5A86453B-96FB-4B6E-A283-225BB9F753D3}.Release|Any CPU.Build.0 = Release|Any CPU
{5A86453B-96FB-4B6E-A283-225BB9F753D3}.Release|x86.ActiveCfg = Release|Any CPU
{F7AC0E71-3E9A-4F6D-B986-E004825A48E1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F7AC0E71-3E9A-4F6D-B986-E004825A48E1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F7AC0E71-3E9A-4F6D-B986-E004825A48E1}.Debug|x86.ActiveCfg = Debug|Any CPU
{F7AC0E71-3E9A-4F6D-B986-E004825A48E1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F7AC0E71-3E9A-4F6D-B986-E004825A48E1}.Release|Any CPU.Build.0 = Release|Any CPU
{F7AC0E71-3E9A-4F6D-B986-E004825A48E1}.Release|x86.ActiveCfg = Release|Any CPU
{BF905F84-382C-440D-92F5-C61108626D8D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BF905F84-382C-440D-92F5-C61108626D8D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BF905F84-382C-440D-92F5-C61108626D8D}.Debug|x86.ActiveCfg = Debug|Any CPU
{BF905F84-382C-440D-92F5-C61108626D8D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BF905F84-382C-440D-92F5-C61108626D8D}.Release|Any CPU.Build.0 = Release|Any CPU
{BF905F84-382C-440D-92F5-C61108626D8D}.Release|x86.ActiveCfg = Release|Any CPU
{F9741A0D-B9D7-4557-9A1C-A7252C1071F5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F9741A0D-B9D7-4557-9A1C-A7252C1071F5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F9741A0D-B9D7-4557-9A1C-A7252C1071F5}.Debug|x86.ActiveCfg = Debug|Any CPU
{F9741A0D-B9D7-4557-9A1C-A7252C1071F5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F9741A0D-B9D7-4557-9A1C-A7252C1071F5}.Release|Any CPU.Build.0 = Release|Any CPU
{F9741A0D-B9D7-4557-9A1C-A7252C1071F5}.Release|x86.ActiveCfg = Release|Any CPU
{75C2BE85-1DAF-4E34-8305-B17AFAA982A6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{75C2BE85-1DAF-4E34-8305-B17AFAA982A6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{75C2BE85-1DAF-4E34-8305-B17AFAA982A6}.Debug|x86.ActiveCfg = Debug|Any CPU
{75C2BE85-1DAF-4E34-8305-B17AFAA982A6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{75C2BE85-1DAF-4E34-8305-B17AFAA982A6}.Release|Any CPU.Build.0 = Release|Any CPU
{75C2BE85-1DAF-4E34-8305-B17AFAA982A6}.Release|x86.ActiveCfg = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
8 changes: 5 additions & 3 deletions GitVersionCore.Tests/GitVersionCore.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,17 @@
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="..\GitVersionTask.Tests\Helpers\DirectoryHelper.cs">
<Link>Helpers\DirectoryHelper.cs</Link>
</Compile>
<Compile Include="BuildServers\BuildServerBaseTests.cs" />
<Compile Include="BuildServers\ContinuaCiTests.cs" />
<Compile Include="BuildServers\MyGetTests.cs" />
<Compile Include="BuildServers\TeamCityTests.cs" />
<Compile Include="Fixtures\CommitCountingRepoFixture.cs" />
<Compile Include="ConfigProviderTests.cs" />
<Compile Include="Fixtures\RemoteRepositoryFixture.cs" />
<Compile Include="GitDirFinderTests.cs" />
<Compile Include="Fixtures\BaseGitFlowRepositoryFixture.cs" />
<Compile Include="GitVersionContextTests.cs" />
<Compile Include="Helpers\DirectoryHelper.cs" />
<Compile Include="IntegrationTests\PullRequestScenarios.cs" />
<Compile Include="IntegrationTests\RemoteRepositoryTests.cs" />
<Compile Include="IntegrationTests\GitFlow\DevelopScenarios.cs" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
using System;
using GitVersion;
using GitVersionCore.Tests;
using LibGit2Sharp;
using LibGit2Sharp;
using NUnit.Framework;
using Shouldly;

Expand Down Expand Up @@ -80,89 +77,6 @@ public void CanCorrectlyDetectCommitCountsSemVer()
}
}


/*
* hotfix-1.2.1 -----------C--
* / \
* master A----------------F-----H-------N
* \ / \ /
* hotfix-1.3.1 \ / ----L
* \ / \
* release-1.3.0 \ -D----G--- \
* \ / \ \
* develop -----B----E-------I-----M--O--P
* \ /
* feature -------J-K-
*
*
* - A is tagged `1.2.0`
* - F is tagged `1.2.1`
* - H is tagged `1.3.0`
* - N is tagged `1.3.1`
*/

[Test]
public void CanCorrectlyDetectCommitCountsAndReleaseDataWhenThatApplies()
{
using (var f = new CommitCountingRepoFixture())
{
ResetToP(f.Repository);
EnsureBranchMatch(f, "develop");

ResetToO(f.Repository);
EnsureBranchMatch(f, "develop");

ResetToN(f.Repository);
EnsureBranchMatch(f, "master", r => (Commit)r.Tags["1.3.0"].Target);

ResetToM(f.Repository);
EnsureBranchMatch(f, "develop");

ResetToL(f.Repository);
EnsureBranchMatch(f, "hotfix-1.3.1", r => (Commit)r.Tags["1.3.0"].Target);

ResetToK(f.Repository);
EnsureBranchMatch(f, "feature");

ResetToJ(f.Repository);
EnsureBranchMatch(f, "feature");

ResetToI(f.Repository);
EnsureBranchMatch(f, "develop");

ResetToH(f.Repository);
EnsureBranchMatch(f, "master", r => (Commit)r.Tags["1.3.0"].Target);

ResetToG(f.Repository);
EnsureBranchMatch(f, "release-1.3.0");

ResetToF(f.Repository);
EnsureBranchMatch(f, "master", r => (Commit)r.Tags["1.2.0"].Target);

ResetToE(f.Repository);
EnsureBranchMatch(f, "develop");

ResetToD(f.Repository);
EnsureBranchMatch(f, "release-1.3.0");

ResetToC(f.Repository);
EnsureBranchMatch(f, "hotfix-1.2.1", r => (Commit)r.Tags["1.2.0"].Target);

ResetToB(f.Repository);
EnsureBranchMatch(f, "develop");
}
}

static void EnsureBranchMatch(CommitCountingRepoFixture fixture, string branchName, Func<IRepository, Commit> commitFinder = null)
{
var referenceCommitFinder = commitFinder ?? (r => r.FindBranch(branchName).Tip);

var commit = referenceCommitFinder(fixture.Repository);
var releaseDate = LastMinorVersionFinder.Execute(fixture.Repository, new TestEffectiveConfiguration(), commit);
releaseDate.ShouldBe(commit.When());
}


static void EnsureMetaDataMatch(CommitCountingRepoFixture fixture,string expectedSemVer)
{
var result = fixture.ExecuteGitVersion();
Expand Down
63 changes: 0 additions & 63 deletions GitVersionCore/Extensions/ExtensionMethods.git.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
namespace GitVersion
{
using System;

static partial class ExtensionMethods
{
public static string GetCanonicalBranchName(this string branchName)
Expand All @@ -17,70 +15,9 @@ public static string GetCanonicalBranchName(this string branchName)
return string.Format("refs/heads/{0}", branchName);
}

public static bool IsHotfix(this string branchName)
{
return branchName.StartsWith("hotfix-") || branchName.StartsWith("hotfix/");
}

public static string GetHotfixSuffix(this string branchName)
{
return branchName.TrimStart("hotfix-").TrimStart("hotfix/");
}

public static bool IsRelease(this string branchName)
{
return branchName.StartsWith("release-") || branchName.StartsWith("release/");
}

public static string GetReleaseSuffix(this string branchName)
{
return branchName.TrimStart("release-").TrimStart("release/");
}

public static string GetUnknownBranchSuffix(this string branchName)
{
var unknownBranchSuffix = branchName.Split('-', '/');
if (unknownBranchSuffix.Length == 1)
return branchName;
return unknownBranchSuffix[1];
}

public static string GetSuffix(this string branchName, BranchType branchType)
{
switch (branchType)
{
case BranchType.Hotfix:
return branchName.GetHotfixSuffix();

case BranchType.Release:
return branchName.GetReleaseSuffix();

case BranchType.Unknown:
return branchName.GetUnknownBranchSuffix();

default:
throw new NotSupportedException(string.Format("Unexpected branch type {0}.", branchType));
}
}

public static bool IsDevelop(this string branchName)
{
return branchName == "develop";
}

public static bool IsMaster(this string branchName)
{
return branchName == "master";
}

public static bool IsPullRequest(this string branchName)
{
return branchName.Contains("pull/") || branchName.Contains("pull-requests/") || branchName.Contains("pr/");
}

public static bool IsSupport(this string branchName)
{
return branchName.ToLower().StartsWith("support-") || branchName.ToLower().StartsWith("support/");
}
}
}
57 changes: 0 additions & 57 deletions GitVersionCore/GitFlow/BranchClassifier.cs

This file was deleted.

This file was deleted.

Loading