Skip to content

Updated to newer pre-release of libgitsharp to see if that could fix … #1024

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

Closed
wants to merge 11 commits into from
Closed
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
90 changes: 45 additions & 45 deletions docs/build-server-support/build-server/continua.md
Original file line number Diff line number Diff line change
@@ -1,45 +1,45 @@
# Continua CI Setup
This guide explains how to run GitVersion inside [Continua CI](https://www.finalbuilder.com/continua-ci).
## Assumptions
This guide assumes a few variables are present in the configuration. Note that this example uses `Catel` as repository name, but it should be replaced by the name of the repository where GitVersion is runnign against.
* RepositoryBranchName => $Source.Catel.BranchName$
* RepositoryCommitId => $Source.Catel.LatestChangeset.Id$
* RepositoryName => Catel
* RepositoryName => $Source.Catel.Path$
* RepositoryUrl => $Source.Catel.Url$
It also requires a few variables which will automatically be filled by GitVersion. The example below are just a few, any of the GitVersion variables written to the output can be used.
* GitVersion_FullSemVer
* GitVersion_MajorMinorPatch
* GitVersion_NuGetVersion
You also need to add a property collector for the agents to detect the GitVersion tool on the agents:
* Namespace => GitVersion
* Run On => Agent
* Type => Path Finder Plugin
* Property Name => Path
* Executable => GitVersion.exe
* Search paths => your installation folder (e.g. `C:\Tools\GitVersion` or if you are using Chocolatey `C:\ProgramData\chocolatey\lib\GitVersion.Portable\tools`)
## Basic Usage
To run GitLink inside [Continua CI](https://www.finalbuilder.com/continua-ci), follow the steps below:
* Add a new `Execute Program` step to a stage
* In the `Execute Program` tab, set the following values:
* Executable path: $Agent.GitVersion.Path$
* Working directory: %RepositoryPath%
* In the `Arguments` tab, set the following values:
* Arguments: /url %RepositoryUrl% /b %RepositoryBranchName% /c %RepositoryCommitId% /output buildserver
* In the `Options` tab, set the following values:
* Wait for completion: checked
* Log output: checked
* Check program exit code: checked
* Exit code must be: equal to
* Exit code: 0
Now GitVersion will automatically run and fill the `GitVersion_` variables.
# Continua CI Setup

This guide explains how to run GitVersion inside [Continua CI](https://www.finalbuilder.com/continua-ci).

## Assumptions
This guide assumes a few variables are present in the configuration. Note that this example uses `Catel` as repository name, but it should be replaced by the name of the repository where GitVersion is runnign against.

* RepositoryBranchName => $Source.Catel.BranchName$
* RepositoryCommitId => $Source.Catel.LatestChangeset.Id$
* RepositoryName => Catel
* RepositoryName => $Source.Catel.Path$
* RepositoryUrl => $Source.Catel.Url$

It also requires a few variables which will automatically be filled by GitVersion. The example below are just a few, any of the GitVersion variables written to the output can be used.

* GitVersion_FullSemVer
* GitVersion_MajorMinorPatch
* GitVersion_NuGetVersion

You also need to add a property collector for the agents to detect the GitVersion tool on the agents:

* Namespace => GitVersion
* Run On => Agent
* Type => Path Finder Plugin
* Property Name => Path
* Executable => GitVersion.exe
* Search paths => your installation folder (e.g. `C:\Tools\GitVersion` or if you are using Chocolatey `C:\ProgramData\chocolatey\lib\GitVersion.Portable\tools`)

## Basic Usage
To run GitLink inside [Continua CI](https://www.finalbuilder.com/continua-ci), follow the steps below:

* Add a new `Execute Program` step to a stage
* In the `Execute Program` tab, set the following values:
* Executable path: $Agent.GitVersion.Path$
* Working directory: %RepositoryPath%
* In the `Arguments` tab, set the following values:
* Arguments: /url %RepositoryUrl% /b %RepositoryBranchName% /c %RepositoryCommitId% /output buildserver
* In the `Options` tab, set the following values:
* Wait for completion: checked
* Log output: checked
* Check program exit code: checked
* Exit code must be: equal to
* Exit code: 0

Now GitVersion will automatically run and fill the `GitVersion_` variables.
6 changes: 3 additions & 3 deletions src/GitVersionCore.Tests/GitVersionCore.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\LibGit2Sharp.NativeBinaries.1.0.137\build\LibGit2Sharp.NativeBinaries.props" Condition="Exists('..\packages\LibGit2Sharp.NativeBinaries.1.0.137\build\LibGit2Sharp.NativeBinaries.props')" />
<Import Project="..\packages\LibGit2Sharp.NativeBinaries.1.0.160\build\LibGit2Sharp.NativeBinaries.props" Condition="Exists('..\packages\LibGit2Sharp.NativeBinaries.1.0.160\build\LibGit2Sharp.NativeBinaries.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
Expand Down Expand Up @@ -51,7 +51,7 @@
<Private>True</Private>
</Reference>
<Reference Include="LibGit2Sharp, Version=0.23.0.0, Culture=neutral, PublicKeyToken=7cbde695407f0333, processorArchitecture=MSIL">
<HintPath>..\packages\LibGit2Sharp.0.23.0-pre20150419160303\lib\net40\LibGit2Sharp.dll</HintPath>
<HintPath>..\packages\LibGit2Sharp.0.23.0-pre20160922233542\lib\net40\LibGit2Sharp.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Mono.Cecil, Version=0.9.6.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL">
Expand Down Expand Up @@ -212,7 +212,7 @@
<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>
</PropertyGroup>
<Error Condition="!Exists('..\packages\Fody.1.29.4\build\dotnet\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Fody.1.29.4\build\dotnet\Fody.targets'))" />
<Error Condition="!Exists('..\packages\LibGit2Sharp.NativeBinaries.1.0.137\build\LibGit2Sharp.NativeBinaries.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\LibGit2Sharp.NativeBinaries.1.0.137\build\LibGit2Sharp.NativeBinaries.props'))" />
<Error Condition="!Exists('..\packages\LibGit2Sharp.NativeBinaries.1.0.160\build\LibGit2Sharp.NativeBinaries.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\LibGit2Sharp.NativeBinaries.1.0.160\build\LibGit2Sharp.NativeBinaries.props'))" />
</Target>
<Import Project="..\packages\Fody.1.29.4\build\dotnet\Fody.targets" Condition="Exists('..\packages\Fody.1.29.4\build\dotnet\Fody.targets')" />
</Project>
5 changes: 5 additions & 0 deletions src/GitVersionCore.Tests/Mocks/MockQueryableCommitLog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ public IEnumerable<LogEntry> QueryBy(string path, FollowFilter filter)
throw new NotImplementedException();
}

public IEnumerable<LogEntry> QueryBy(string path, CommitFilter filter)
{
throw new NotImplementedException();
}

public Commit FindMergeBase(Commit first, Commit second)
{
return null;
Expand Down
10 changes: 10 additions & 0 deletions src/GitVersionCore.Tests/Mocks/MockRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ public Branch Checkout(Commit commit, CheckoutOptions options)
throw new NotImplementedException();
}

public void Checkout(Tree tree, IEnumerable<string> paths, CheckoutOptions opts)
{
throw new NotImplementedException();
}

public void CheckoutPaths(string committishOrBranchSpec, IEnumerable<string> paths, CheckoutOptions checkoutOptions = null)
{
throw new NotImplementedException();
Expand Down Expand Up @@ -197,6 +202,11 @@ public string Describe(Commit commit, DescribeOptions options)
throw new NotImplementedException();
}

public void RevParse(string revision, out Reference reference, out GitObject obj)
{
throw new NotImplementedException();
}

public Branch Head { get; set; }
public Configuration Config { get; set; }
public Index Index { get; set; }
Expand Down
4 changes: 2 additions & 2 deletions src/GitVersionCore.Tests/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<package id="Fody" version="1.29.4" targetFramework="net45" developmentDependency="true" />
<package id="GitTools.Core" version="1.2.0" targetFramework="net45" />
<package id="GitTools.Testing" version="1.1.1-beta0001" targetFramework="net45" />
<package id="LibGit2Sharp" version="0.23.0-pre20150419160303" targetFramework="net45" />
<package id="LibGit2Sharp.NativeBinaries" version="1.0.137" targetFramework="net45" />
<package id="LibGit2Sharp" version="0.23.0-pre20160922233542" targetFramework="net45" />
<package id="LibGit2Sharp.NativeBinaries" version="1.0.160" targetFramework="net45" />
<package id="ModuleInit.Fody" version="1.5.9.0" targetFramework="net45" developmentDependency="true" />
<package id="NSubstitute" version="1.10.0.0" targetFramework="net45" />
<package id="NUnit" version="3.4.1" targetFramework="net45" />
Expand Down
6 changes: 3 additions & 3 deletions src/GitVersionCore/GitVersionCore.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\LibGit2Sharp.NativeBinaries.1.0.137\build\LibGit2Sharp.NativeBinaries.props" Condition="Exists('..\packages\LibGit2Sharp.NativeBinaries.1.0.137\build\LibGit2Sharp.NativeBinaries.props')" />
<Import Project="..\packages\LibGit2Sharp.NativeBinaries.1.0.160\build\LibGit2Sharp.NativeBinaries.props" Condition="Exists('..\packages\LibGit2Sharp.NativeBinaries.1.0.160\build\LibGit2Sharp.NativeBinaries.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
Expand Down Expand Up @@ -48,7 +48,7 @@
<Private>False</Private>
</Reference>
<Reference Include="LibGit2Sharp, Version=0.23.0.0, Culture=neutral, PublicKeyToken=7cbde695407f0333, processorArchitecture=MSIL">
<HintPath>..\packages\LibGit2Sharp.0.23.0-pre20150419160303\lib\net40\LibGit2Sharp.dll</HintPath>
<HintPath>..\packages\LibGit2Sharp.0.23.0-pre20160922233542\lib\net40\LibGit2Sharp.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
Expand Down Expand Up @@ -197,7 +197,7 @@
</PropertyGroup>
<Error Condition="!Exists('..\packages\PepitaPackage.1.21.4\build\PepitaPackage.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\PepitaPackage.1.21.4\build\PepitaPackage.targets'))" />
<Error Condition="!Exists('..\packages\Fody.1.29.4\build\portable-net+sl+win+wpa+wp\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Fody.1.29.4\build\portable-net+sl+win+wpa+wp\Fody.targets'))" />
<Error Condition="!Exists('..\packages\LibGit2Sharp.NativeBinaries.1.0.137\build\LibGit2Sharp.NativeBinaries.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\LibGit2Sharp.NativeBinaries.1.0.137\build\LibGit2Sharp.NativeBinaries.props'))" />
<Error Condition="!Exists('..\packages\LibGit2Sharp.NativeBinaries.1.0.160\build\LibGit2Sharp.NativeBinaries.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\LibGit2Sharp.NativeBinaries.1.0.160\build\LibGit2Sharp.NativeBinaries.props'))" />
</Target>
<PropertyGroup>
<PostBuildEvent>
Expand Down
4 changes: 2 additions & 2 deletions src/GitVersionCore/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<package id="Fody" version="1.29.4" targetFramework="net40" developmentDependency="true" />
<package id="GitTools.Core" version="1.2.0" targetFramework="net40" />
<package id="JetBrainsAnnotations.Fody" version="1.0.4.0" targetFramework="net4" developmentDependency="true" />
<package id="LibGit2Sharp" version="0.23.0-pre20150419160303" targetFramework="net40" />
<package id="LibGit2Sharp.NativeBinaries" version="1.0.137" targetFramework="net40" />
<package id="LibGit2Sharp" version="0.23.0-pre20160922233542" targetFramework="net40" />
<package id="LibGit2Sharp.NativeBinaries" version="1.0.160" targetFramework="net40" />
<package id="PepitaPackage" version="1.21.4" targetFramework="net4" developmentDependency="true" />
<package id="Visualize.Fody" version="0.4.5.0" targetFramework="net40" developmentDependency="true" />
<package id="YamlDotNet" version="3.8.0" targetFramework="net40" />
Expand Down
6 changes: 3 additions & 3 deletions src/GitVersionExe.Tests/GitVersionExe.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\LibGit2Sharp.NativeBinaries.1.0.137\build\LibGit2Sharp.NativeBinaries.props" Condition="Exists('..\packages\LibGit2Sharp.NativeBinaries.1.0.137\build\LibGit2Sharp.NativeBinaries.props')" />
<Import Project="..\packages\LibGit2Sharp.NativeBinaries.1.0.160\build\LibGit2Sharp.NativeBinaries.props" Condition="Exists('..\packages\LibGit2Sharp.NativeBinaries.1.0.160\build\LibGit2Sharp.NativeBinaries.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
Expand Down Expand Up @@ -44,7 +44,7 @@
<Private>True</Private>
</Reference>
<Reference Include="LibGit2Sharp, Version=0.23.0.0, Culture=neutral, PublicKeyToken=7cbde695407f0333, processorArchitecture=MSIL">
<HintPath>..\packages\LibGit2Sharp.0.23.0-pre20150419160303\lib\net40\LibGit2Sharp.dll</HintPath>
<HintPath>..\packages\LibGit2Sharp.0.23.0-pre20160922233542\lib\net40\LibGit2Sharp.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Mono.Cecil, Version=0.9.6.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL">
Expand Down Expand Up @@ -156,6 +156,6 @@
<PropertyGroup>
<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>
</PropertyGroup>
<Error Condition="!Exists('..\packages\LibGit2Sharp.NativeBinaries.1.0.137\build\LibGit2Sharp.NativeBinaries.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\LibGit2Sharp.NativeBinaries.1.0.137\build\LibGit2Sharp.NativeBinaries.props'))" />
<Error Condition="!Exists('..\packages\LibGit2Sharp.NativeBinaries.1.0.160\build\LibGit2Sharp.NativeBinaries.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\LibGit2Sharp.NativeBinaries.1.0.160\build\LibGit2Sharp.NativeBinaries.props'))" />
</Target>
</Project>
11 changes: 7 additions & 4 deletions src/GitVersionExe.Tests/PullRequestInTeamCityTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,25 @@ public void GivenARemoteWithATagOnMaster_AndAPullRequestWithTwoCommits_AndBuildI
remoteRepository.MakeATaggedCommit("1.0.3");

var branch = remoteRepository.CreateBranch("FeatureBranch");
remoteRepository.Checkout(branch);
Commands.Checkout(remoteRepository, branch);
remoteRepository.MakeCommits(2);
remoteRepository.Checkout(remoteRepository.Head.Tip.Sha);
Commands.Checkout(remoteRepository, remoteRepository.Head.Tip.Sha);
//Emulate merge commit
var mergeCommitSha = remoteRepository.MakeACommit().Sha;
remoteRepository.Checkout("master"); // HEAD cannot be pointing at the merge commit
Commands.Checkout(remoteRepository, "master"); // HEAD cannot be pointing at the merge commit
remoteRepository.Refs.Add(pullRequestRef, new ObjectId(mergeCommitSha));

// Checkout PR commit
Commands.Fetch((Repository)fixture.Repository, "origin", new string[0], new FetchOptions(), null);
fixture.Repository.Checkout(mergeCommitSha);
Commands.Checkout(fixture.Repository, mergeCommitSha);
}

var result = GitVersionHelper.ExecuteIn(fixture.RepositoryPath, isTeamCity: true);

result.ExitCode.ShouldBe(0);

result.Output.ShouldStartWith("{", "we expect valid json output to parse back output variables");

result.OutputVariables.FullSemVer.ShouldBe("1.0.4-PullRequest0005.3");

// Cleanup repository files
Expand Down
4 changes: 2 additions & 2 deletions src/GitVersionExe.Tests/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<packages>
<package id="GitTools.Core" version="1.2.0" targetFramework="net45" />
<package id="GitTools.Testing" version="1.1.1-beta0001" targetFramework="net45" />
<package id="LibGit2Sharp" version="0.23.0-pre20150419160303" targetFramework="net45" />
<package id="LibGit2Sharp.NativeBinaries" version="1.0.137" targetFramework="net45" />
<package id="LibGit2Sharp" version="0.23.0-pre20160922233542" targetFramework="net45" />
<package id="LibGit2Sharp.NativeBinaries" version="1.0.160" targetFramework="net45" />
<package id="NSubstitute" version="1.10.0.0" targetFramework="net45" />
<package id="NUnit" version="3.4.1" targetFramework="net45" />
<package id="NUnit3TestAdapter" version="3.4.1" targetFramework="net45" />
Expand Down
6 changes: 3 additions & 3 deletions src/GitVersionExe/GitVersionExe.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\LibGit2Sharp.NativeBinaries.1.0.137\build\LibGit2Sharp.NativeBinaries.props" Condition="Exists('..\packages\LibGit2Sharp.NativeBinaries.1.0.137\build\LibGit2Sharp.NativeBinaries.props')" />
<Import Project="..\packages\LibGit2Sharp.NativeBinaries.1.0.160\build\LibGit2Sharp.NativeBinaries.props" Condition="Exists('..\packages\LibGit2Sharp.NativeBinaries.1.0.160\build\LibGit2Sharp.NativeBinaries.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
Expand Down Expand Up @@ -50,7 +50,7 @@
<Private>False</Private>
</Reference>
<Reference Include="LibGit2Sharp, Version=0.23.0.0, Culture=neutral, PublicKeyToken=7cbde695407f0333, processorArchitecture=MSIL">
<HintPath>..\packages\LibGit2Sharp.0.23.0-pre20150419160303\lib\net40\LibGit2Sharp.dll</HintPath>
<HintPath>..\packages\LibGit2Sharp.0.23.0-pre20160922233542\lib\net40\LibGit2Sharp.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
Expand Down Expand Up @@ -219,7 +219,7 @@
</PropertyGroup>
<Error Condition="!Exists('..\packages\PepitaPackage.1.21.4\build\PepitaPackage.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\PepitaPackage.1.21.4\build\PepitaPackage.targets'))" />
<Error Condition="!Exists('..\packages\Fody.1.29.4\build\portable-net+sl+win+wpa+wp\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Fody.1.29.4\build\portable-net+sl+win+wpa+wp\Fody.targets'))" />
<Error Condition="!Exists('..\packages\LibGit2Sharp.NativeBinaries.1.0.137\build\LibGit2Sharp.NativeBinaries.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\LibGit2Sharp.NativeBinaries.1.0.137\build\LibGit2Sharp.NativeBinaries.props'))" />
<Error Condition="!Exists('..\packages\LibGit2Sharp.NativeBinaries.1.0.160\build\LibGit2Sharp.NativeBinaries.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\LibGit2Sharp.NativeBinaries.1.0.160\build\LibGit2Sharp.NativeBinaries.props'))" />
</Target>
<Import Project="..\packages\PepitaPackage.1.21.4\build\PepitaPackage.targets" Condition="Exists('..\packages\PepitaPackage.1.21.4\build\PepitaPackage.targets')" />
<Import Project="..\packages\Fody.1.29.4\build\portable-net+sl+win+wpa+wp\Fody.targets" Condition="Exists('..\packages\Fody.1.29.4\build\portable-net+sl+win+wpa+wp\Fody.targets')" />
Expand Down
Loading