Skip to content

Commit 14487a0

Browse files
committed
Merge remote-tracking branch 'upstream/master' into BranchSpecificConfiguration
2 parents b924119 + e2b8860 commit 14487a0

File tree

46 files changed

+818
-568
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+818
-568
lines changed

GitVersion.sln.GhostDoc.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
<Protected>false</Protected>
2424
<Private>false</Private>
2525
<Inherited>true</Inherited>
26+
<InheritedFromReferences>true</InheritedFromReferences>
2627
<EnableTags>false</EnableTags>
2728
<TagList />
2829
</IncludeScopes>

GitVersionCore.Tests/ConfigProviderTests.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
using System.Reflection;
55
using GitVersion;
66
using GitVersion.Helpers;
7-
using GitVersionCore.Tests;
87
using NUnit.Framework;
98
using Shouldly;
109
using YamlDotNet.Serialization;
Lines changed: 33 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,48 @@
11
using System;
22

3-
namespace GitVersionCore.Tests.Fixtures
4-
{
53
using GitVersion;
64
using LibGit2Sharp;
75

8-
public class RemoteRepositoryFixture : RepositoryFixtureBase
9-
{
10-
public string LocalRepositoryPath;
11-
public IRepository LocalRepository;
12-
13-
public RemoteRepositoryFixture(Config configuration)
14-
: base(CreateNewRepository, configuration)
15-
{
16-
17-
CloneRepository();
18-
}
6+
public class RemoteRepositoryFixture : RepositoryFixtureBase
7+
{
8+
public string LocalRepositoryPath;
9+
public IRepository LocalRepository;
1910

20-
11+
public RemoteRepositoryFixture(Config configuration)
12+
: base(CreateNewRepository, configuration)
13+
{
14+
CloneRepository();
15+
}
2116

22-
static IRepository CreateNewRepository(string path)
23-
{
24-
LibGit2Sharp.Repository.Init(path);
25-
Console.WriteLine("Created git repository at '{0}'", path);
17+
static IRepository CreateNewRepository(string path)
18+
{
19+
LibGit2Sharp.Repository.Init(path);
20+
Console.WriteLine("Created git repository at '{0}'", path);
2621

27-
var repo = new Repository(path);
28-
repo.MakeCommits(5);
29-
return repo;
30-
}
22+
var repo = new Repository(path);
23+
repo.MakeCommits(5);
24+
return repo;
25+
}
3126

27+
void CloneRepository()
28+
{
29+
LocalRepositoryPath = PathHelper.GetTempPath();
30+
LibGit2Sharp.Repository.Clone(RepositoryPath, LocalRepositoryPath);
31+
LocalRepository = new Repository(LocalRepositoryPath);
32+
}
3233

33-
void CloneRepository()
34+
public override void Dispose()
35+
{
36+
LocalRepository.Dispose();
37+
try
3438
{
35-
LocalRepositoryPath = PathHelper.GetTempPath();
36-
LibGit2Sharp.Repository.Clone(RepositoryPath, LocalRepositoryPath);
37-
LocalRepository = new Repository(LocalRepositoryPath);
39+
DirectoryHelper.DeleteDirectory(LocalRepositoryPath);
3840
}
39-
40-
41-
public override void Dispose()
41+
catch (Exception e)
4242
{
43-
LocalRepository.Dispose();
44-
try
45-
{
46-
DirectoryHelper.DeleteDirectory(LocalRepositoryPath);
47-
}
48-
catch (Exception e)
49-
{
50-
Console.WriteLine("Failed to clean up repository path at {0}. Received exception: {1}", RepositoryPath, e.Message);
51-
}
52-
53-
base.Dispose();
43+
Console.WriteLine("Failed to clean up repository path at {0}. Received exception: {1}", RepositoryPath, e.Message);
5444
}
45+
46+
base.Dispose();
5547
}
56-
}
48+
}

GitVersionCore.Tests/GitVersionCore.Tests.csproj

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="..\packages\LibGit2Sharp.0.20.1.0\build\net40\LibGit2Sharp.props" Condition="Exists('..\packages\LibGit2Sharp.0.20.1.0\build\net40\LibGit2Sharp.props')" />
34
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
45
<PropertyGroup>
56
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -12,7 +13,7 @@
1213
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
1314
<FileAlignment>512</FileAlignment>
1415
<TargetFrameworkProfile />
15-
<NuGetPackageImportStamp>1123b588</NuGetPackageImportStamp>
16+
<NuGetPackageImportStamp>e51a7a82</NuGetPackageImportStamp>
1617
</PropertyGroup>
1718
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
1819
<DebugSymbols>true</DebugSymbols>
@@ -42,16 +43,17 @@
4243
<SpecificVersion>False</SpecificVersion>
4344
<HintPath>..\packages\ApprovalUtilities.3.0.7\lib\net35\ApprovalUtilities.dll</HintPath>
4445
</Reference>
45-
<Reference Include="LibGit2Sharp, Version=0.19.0.0, Culture=neutral, processorArchitecture=MSIL">
46+
<Reference Include="LibGit2Sharp, Version=0.20.1.0, Culture=neutral, processorArchitecture=MSIL">
4647
<SpecificVersion>False</SpecificVersion>
47-
<HintPath>..\packages\LibGit2Sharp.0.19.0.0\lib\net40\LibGit2Sharp.dll</HintPath>
48+
<HintPath>..\packages\LibGit2Sharp.0.20.1.0\lib\net40\LibGit2Sharp.dll</HintPath>
4849
</Reference>
49-
<Reference Include="nunit.framework">
50-
<HintPath>..\packages\NUnit.2.6.3\lib\nunit.framework.dll</HintPath>
50+
<Reference Include="nunit.framework, Version=2.6.4.14350, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
51+
<SpecificVersion>False</SpecificVersion>
52+
<HintPath>..\packages\NUnit.2.6.4\lib\nunit.framework.dll</HintPath>
5153
</Reference>
52-
<Reference Include="Shouldly, Version=2.2.0.0, Culture=neutral, PublicKeyToken=6042cbcb05cbc941, processorArchitecture=MSIL">
54+
<Reference Include="Shouldly, Version=2.3.1.0, Culture=neutral, PublicKeyToken=6042cbcb05cbc941, processorArchitecture=MSIL">
5355
<SpecificVersion>False</SpecificVersion>
54-
<HintPath>..\packages\Shouldly.2.2.0\lib\net40\Shouldly.dll</HintPath>
56+
<HintPath>..\packages\Shouldly.2.3.1\lib\net40\Shouldly.dll</HintPath>
5557
</Reference>
5658
<Reference Include="System" />
5759
<Reference Include="System.Core" />
@@ -60,9 +62,9 @@
6062
<Reference Include="System.Data.DataSetExtensions" />
6163
<Reference Include="System.Data" />
6264
<Reference Include="System.Xml" />
63-
<Reference Include="YamlDotNet, Version=3.3.0.0, Culture=neutral, processorArchitecture=MSIL">
65+
<Reference Include="YamlDotNet, Version=3.5.0.0, Culture=neutral, processorArchitecture=MSIL">
6466
<SpecificVersion>False</SpecificVersion>
65-
<HintPath>..\packages\YamlDotNet.3.3.1\lib\net35\YamlDotNet.dll</HintPath>
67+
<HintPath>..\packages\YamlDotNet.3.5.0\lib\net35\YamlDotNet.dll</HintPath>
6668
</Reference>
6769
</ItemGroup>
6870
<ItemGroup>
@@ -77,19 +79,19 @@
7779
<Compile Include="GitVersionContextTests.cs" />
7880
<Compile Include="IntegrationTests\RemoteRepositoryTests.cs" />
7981
<Compile Include="IntegrationTests\GitFlow\DevelopScenarios.cs" />
80-
<Compile Include="IntegrationTests\GitFlow\FeatureBranchTests.cs" />
81-
<Compile Include="IntegrationTests\GitFlow\SupportBranchScenarios.cs" />
82+
<Compile Include="IntegrationTests\GitFlow\GitFlowFeatureBranchTests.cs" />
83+
<Compile Include="IntegrationTests\GitFlow\GitFlowSupportBranchScenarios.cs" />
8284
<Compile Include="IntegrationTests\GitFlow\MetaDataByCommitScenarios.cs" />
8385
<Compile Include="IntegrationTests\GitFlow\PatchScenarios.cs" />
8486
<Compile Include="IntegrationTests\GitFlow\ReleaseBranchTests.cs" />
8587
<Compile Include="IntegrationTests\GitFlow\SwitchingToGitFlowScenarios.cs" />
8688
<Compile Include="IntegrationTests\GitFlow\UncycloScenarios.cs" />
87-
<Compile Include="IntegrationTests\GitHubFlow\FeatureBranchTests.cs" />
89+
<Compile Include="IntegrationTests\GitHubFlow\GitHubFlowFeatureBranchTests.cs" />
8890
<Compile Include="IntegrationTests\GitHubFlow\OtherBranchTests.cs" />
8991
<Compile Include="IntegrationTests\GitHubFlow\ReleaseBranchTests.cs" />
9092
<Compile Include="Helpers\Constants.cs" />
9193
<Compile Include="InformationalVersionBuilderTests.cs" />
92-
<Compile Include="IntegrationTests\GitHubFlow\SupportBranchScenarios.cs" />
94+
<Compile Include="IntegrationTests\GitHubFlow\GitHubFlowSupportBranchScenarios.cs" />
9395
<Compile Include="JsonVersionBuilderTests.cs" />
9496
<Compile Include="Mocks\MockBranch.cs" />
9597
<Compile Include="Mocks\MockBranchCollection.cs" />
@@ -142,17 +144,14 @@
142144
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
143145
<PropertyGroup>
144146
<PostBuildEvent>
145-
if not exist "$(TargetDir)NativeBinaries" md "$(TargetDir)NativeBinaries"
146-
if not exist "$(TargetDir)NativeBinaries\x86" md "$(TargetDir)NativeBinaries\x86"
147-
xcopy /s /y /d "$(SolutionDir)packages\LibGit2Sharp.0.19.0.0\lib\net40\NativeBinaries\x86\*.*" "$(TargetDir)NativeBinaries\x86"
148-
if not exist "$(TargetDir)NativeBinaries\amd64" md "$(TargetDir)NativeBinaries\amd64"
149-
xcopy /s /y /d "$(SolutionDir)packages\LibGit2Sharp.0.19.0.0\lib\net40\NativeBinaries\amd64\*.*" "$(TargetDir)NativeBinaries\amd64"</PostBuildEvent>
147+
</PostBuildEvent>
150148
</PropertyGroup>
151-
<Import Project="..\packages\Fody.1.26.2\build\Fody.targets" Condition="Exists('..\packages\Fody.1.26.2\build\Fody.targets')" />
149+
<Import Project="..\packages\Fody.1.26.4\build\Fody.targets" Condition="Exists('..\packages\Fody.1.26.4\build\Fody.targets')" />
152150
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
153151
<PropertyGroup>
154-
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
152+
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
155153
</PropertyGroup>
156-
<Error Condition="!Exists('..\packages\Fody.1.26.2\build\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Fody.1.26.2\build\Fody.targets'))" />
154+
<Error Condition="!Exists('..\packages\Fody.1.26.4\build\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Fody.1.26.4\build\Fody.targets'))" />
155+
<Error Condition="!Exists('..\packages\LibGit2Sharp.0.20.1.0\build\net40\LibGit2Sharp.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\LibGit2Sharp.0.20.1.0\build\net40\LibGit2Sharp.props'))" />
157156
</Target>
158157
</Project>

GitVersionCore.Tests/Helpers/Constants.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,20 @@
33

44
public static class Constants
55
{
6+
static DateTimeOffset simulatedTime = DateTimeOffset.Now.AddHours(-1);
7+
8+
public static DateTimeOffset Now
9+
{
10+
get
11+
{
12+
simulatedTime = simulatedTime.AddMinutes(1);
13+
return simulatedTime;
14+
}
15+
}
16+
617
public static Signature SignatureNow()
718
{
8-
var dateTimeOffset = DateTimeOffset.Now;
19+
var dateTimeOffset = Now;
920
return Signature(dateTimeOffset);
1021
}
1122

GitVersionCore.Tests/Helpers/GitTestExtensions.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ public static class GitTestExtensions
88
{
99
public static Commit MakeACommit(this IRepository repository)
1010
{
11-
return MakeACommit(repository, DateTimeOffset.Now);
11+
return MakeACommit(repository, Constants.Now);
1212
}
1313

1414
public static Commit MakeACommit(this IRepository repository, DateTimeOffset dateTimeOffset)
1515
{
1616
var randomFile = Path.Combine(repository.Info.WorkingDirectory, Guid.NewGuid().ToString());
1717
File.WriteAllText(randomFile, string.Empty);
18-
repository.Index.Stage(randomFile);
18+
repository.Stage(randomFile);
1919
return repository.Commit("Test Commit", Constants.Signature(dateTimeOffset), Constants.Signature(dateTimeOffset));
2020
}
2121

@@ -26,6 +26,7 @@ public static void MergeNoFF(this IRepository repository, string branch)
2626

2727
public static void MergeNoFF(this IRepository repository, string branch, Signature sig)
2828
{
29+
// Fixes a race condition
2930
repository.Merge(repository.FindBranch(branch), sig, new MergeOptions
3031
{
3132
FastForwardStrategy = FastForwardStrategy.NoFastFoward

GitVersionCore.Tests/IntegrationTests/GitFlow/FeatureBranchTests.cs renamed to GitVersionCore.Tests/IntegrationTests/GitFlow/GitFlowFeatureBranchTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
using NUnit.Framework;
44

55
[TestFixture]
6-
public class FeatureBranchTests
6+
public class GitFlowFeatureBranchTests
77
{
88
[Test]
99
public void ShouldNotUseNumberInFeatureBranchAsPreReleaseNumber()
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
using LibGit2Sharp;
2+
using NUnit.Framework;
3+
4+
[TestFixture]
5+
public class GitFlowSupportBranchScenarios
6+
{
7+
[Test]
8+
public void SupportIsCalculatedCorrectly()
9+
{
10+
using (var fixture = new BaseGitFlowRepositoryFixture("1.1.0"))
11+
{
12+
// Create 2.0.0 release
13+
fixture.Repository.CreateBranch("release-2.0.0").Checkout();
14+
fixture.Repository.MakeCommits(2);
15+
16+
// Merge into develop and master
17+
fixture.Repository.Checkout("master");
18+
fixture.Repository.MergeNoFF("release-2.0.0");
19+
fixture.Repository.ApplyTag("2.0.0");
20+
fixture.Repository.Checkout("develop");
21+
fixture.Repository.MergeNoFF("release-2.0.0");
22+
fixture.AssertFullSemver("2.1.0-unstable.1+1");
23+
24+
// Now lets support 1.x release
25+
fixture.Repository.Checkout("1.1.0");
26+
fixture.Repository.CreateBranch("support/1.0.0").Checkout();
27+
fixture.AssertFullSemver("1.1.0");
28+
29+
// Create release branch from support branch
30+
fixture.Repository.CreateBranch("release/1.2.0").Checkout();
31+
fixture.Repository.MakeACommit();
32+
fixture.AssertFullSemver("1.2.0-beta.1+1");
33+
34+
// Create 1.2.0 release
35+
fixture.Repository.Checkout("support/1.0.0");
36+
fixture.Repository.MergeNoFF("release/1.2.0");
37+
fixture.AssertFullSemver("1.2.0");
38+
fixture.Repository.ApplyTag("1.2.0");
39+
40+
// Create 1.2.1 hotfix
41+
fixture.Repository.CreateBranch("hotfix/1.2.1").Checkout();
42+
fixture.Repository.MakeACommit();
43+
fixture.AssertFullSemver("1.2.1-beta.1+3"); // TODO This should be +1
44+
fixture.Repository.Checkout("support/1.0.0");
45+
fixture.Repository.MergeNoFF("hotfix/1.2.1");
46+
fixture.AssertFullSemver("1.2.1");
47+
}
48+
}
49+
}

GitVersionCore.Tests/IntegrationTests/GitFlow/SupportBranchScenarios.cs

Lines changed: 0 additions & 52 deletions
This file was deleted.

0 commit comments

Comments
 (0)