Skip to content

Commit

Permalink
Merge pull request #1581 from arturcic/feature/Remove_GitTools.Core
Browse files Browse the repository at this point in the history
Removed GitTools.Core dependency
  • Loading branch information
asbjornu committed Feb 13, 2019
2 parents 6baa63d + 4c8c8eb commit 81c8c84
Show file tree
Hide file tree
Showing 58 changed files with 719 additions and 275 deletions.
2 changes: 1 addition & 1 deletion src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

</PropertyGroup>
<PropertyGroup>
<PackageVersion_GitToolsCore>1.3.1</PackageVersion_GitToolsCore>
<PackageVersion_LibGit2Sharp>0.25.0-preview-0033</PackageVersion_LibGit2Sharp>
<PackageVersion_LibGit2SharpNativeBinaries>[1.0.185]</PackageVersion_LibGit2SharpNativeBinaries>
<PackageVersion_JetBrainsAnnotations>2018.3.0</PackageVersion_JetBrainsAnnotations>
<PackageVersion_YamlDotNet>5.3.0</PackageVersion_YamlDotNet>
Expand Down
5 changes: 2 additions & 3 deletions src/GitVersionCore.Tests/AssemblyInfoFileUpdaterTests.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using GitVersion;
using GitVersion.Helpers;
using GitVersionCore.Tests;
Expand Down Expand Up @@ -482,4 +481,4 @@ public void ShouldNotAddAssemblyInformationalVersionWhenUpdatingAssemblyVersionF

verify(fileSystem, variables);
}
}
}
4 changes: 1 addition & 3 deletions src/GitVersionCore.Tests/CommitDateTests.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System;
using System.Linq;
using GitVersion;
using GitVersion.VersionFilters;
Expand Down
1 change: 0 additions & 1 deletion src/GitVersionCore.Tests/ConfigProviderTests.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using GitTools;
using GitVersion;
using GitVersion.Helpers;
using GitVersionCore.Tests;
Expand Down
5 changes: 2 additions & 3 deletions src/GitVersionCore.Tests/GitRepoMetadataProviderTests.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
namespace GitVersionCore.Tests
namespace GitVersionCore.Tests
{
using System;
using GitTools;
using GitTools.Testing;
using GitVersion;
using NUnit.Framework;
Expand Down Expand Up @@ -197,4 +196,4 @@ public void FindsCorrectMergeBaseForMultipleForwardMerges()
}
}
}
}
}
5 changes: 2 additions & 3 deletions src/GitVersionCore.Tests/GitToolsTestingExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
namespace GitVersionCore.Tests
namespace GitVersionCore.Tests
{
using System;
using GitTools;
using GitTools.Testing;
using GitVersion;
using LibGit2Sharp;
Expand Down Expand Up @@ -77,4 +76,4 @@ public static void InitialiseRepo(this RemoteRepositoryFixture fixture)
new GitPreparer(null, null, new Authentication(), false, fixture.LocalRepositoryFixture.RepositoryPath).Initialise(true, null);
}
}
}
}
3 changes: 1 addition & 2 deletions src/GitVersionCore.Tests/GitVersionCore.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net461</TargetFramework>
Expand All @@ -13,7 +13,6 @@
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" />
<PackageReference Include="FluentDateTime" Version="1.15.0" />
<PackageReference Include="GitTools.Core" Version="$(PackageVersion_GitToolsCore)" />
<PackageReference Include="GitTools.Testing" Version="1.2.0" />
<PackageReference Include="JetBrains.Annotations" Version="$(PackageVersion_JetBrainsAnnotations)"></PackageReference>
<PackageReference Include="NSubstitute" Version="4.0.0" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
using System;
using System.Collections.Generic;
using System;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using GitVersion;
using NUnit.Framework;
using Shouldly;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System;
using GitTools;
using System;
using GitTools.Testing;
using GitVersion;
using GitVersionCore.Tests;
using NUnit.Framework;
using Shouldly;
Expand Down Expand Up @@ -423,4 +423,4 @@ public void GitHubFlowMajorRelease()
fixture.AssertFullSemver("2.0.1+1");
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using GitTools;
using GitTools.Testing;
using GitVersion;
using GitVersionCore.Tests;
using LibGit2Sharp;
using NUnit.Framework;
Expand Down Expand Up @@ -109,4 +109,4 @@ public void CalculatesCorrectVersionAfterReleaseBranchMergedToMaster()
fixture.AssertFullSemver("2.0.0-PullRequest0002.0");
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
using System;
using GitTools.Git;
using System;
using GitTools.Testing;
using GitVersion;
using GitVersionCore.Tests;
using LibGit2Sharp;
using NUnit.Framework;
using Shouldly;
using GitTools;

[TestFixture]
public class RemoteRepositoryScenarios : TestBase
Expand Down Expand Up @@ -87,4 +86,4 @@ public void GivenARemoteGitRepositoryWhenCheckingOutDetachedhead_UsingTrackingBr
fixture.AssertFullSemver("0.1.0+4", fixture.LocalRepositoryFixture.Repository);
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
namespace GitVersionCore.Tests.VersionCalculation
namespace GitVersionCore.Tests.VersionCalculation
{
using System;
using System.Collections.Generic;
using GitTools;
using GitTools.Testing;
using GitVersion;
using GitVersion.VersionCalculation;
Expand Down Expand Up @@ -152,4 +151,4 @@ public void PreReleaseNumberShouldBeScopeToPreReleaseLabelInContinuousDelivery()
}
}
}
}
}
2 changes: 1 addition & 1 deletion src/GitVersionCore/Authentication.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ public Authentication()
public string Username;
public string Password;
}
}
}
27 changes: 27 additions & 0 deletions src/GitVersionCore/AuthenticationInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
namespace GitVersion
{
using LibGit2Sharp;

public class AuthenticationInfo
{
public string Username { get; set; }
public string Password { get; set; }
public string Token { get; set; }

public FetchOptions ToFetchOptions()
{
var fetchOptions = new FetchOptions();

if (!string.IsNullOrEmpty(Username))
{
fetchOptions.CredentialsProvider = (url, user, types) => new UsernamePasswordCredentials
{
Username = Username,
Password = Password
};
}

return fetchOptions;
}
}
}
5 changes: 2 additions & 3 deletions src/GitVersionCore/Configuration/Config.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
namespace GitVersion
namespace GitVersion
{
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Text.RegularExpressions;
using YamlDotNet.Serialization;

Expand Down Expand Up @@ -145,4 +144,4 @@ T MergeObjects<T>(T target, T source)
[YamlMember(Alias = "commit-date-format")]
public string CommitDateFormat { get; set; }
}
}
}
1 change: 0 additions & 1 deletion src/GitVersionCore/Configuration/ConfigurationProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ namespace GitVersion
using System.IO;
using System.Linq;
using System.Text;
using WarningException = GitTools.WarningException;

public class ConfigurationProvider
{
Expand Down
1 change: 0 additions & 1 deletion src/GitVersionCore/Configuration/LegacyConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ namespace GitVersion
using System.Collections.Generic;
using System.Linq;
using YamlDotNet.Serialization;
using System.Reflection;

/// <summary>
/// Obsolete properties are added to this, so we can check to see if they are used and provide good error messages for migration
Expand Down
30 changes: 0 additions & 30 deletions src/GitVersionCore/Configuration/TypeHelper.cs

This file was deleted.

11 changes: 11 additions & 0 deletions src/GitVersionCore/Exceptions/BugException.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
namespace GitVersion
{
using System;

public class BugException : Exception
{
public BugException(string message) : base(message)
{
}
}
}
18 changes: 18 additions & 0 deletions src/GitVersionCore/Exceptions/GitToolsException.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
namespace GitVersion
{
using System;

[Serializable]
public class GitToolsException : Exception
{
public GitToolsException(string messageFormat, params object[] args)
: base(string.Format(messageFormat, args))
{
}

public GitToolsException(string message, Exception innerException)
: base(message, innerException)
{
}
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
namespace GitVersion
namespace GitVersion
{
using System;

using GitTools;

[Serializable]
public class GitVersionException : GitToolsException
{
Expand All @@ -18,4 +16,4 @@ public GitVersionException(string message, Exception innerException)
{
}
}
}
}
13 changes: 13 additions & 0 deletions src/GitVersionCore/Exceptions/WarningException.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
namespace GitVersion
{
using System;

[Serializable]
public class WarningException : Exception
{
public WarningException(string message)
: base(message)
{
}
}
}
9 changes: 3 additions & 6 deletions src/GitVersionCore/ExecuteCore.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
namespace GitVersion
{
using GitTools;
using GitVersion.Helpers;
using LibGit2Sharp;
using System;
using System.ComponentModel;
using System.Linq;
using System.Threading.Tasks;

public class ExecuteCore
{
Expand Down Expand Up @@ -126,18 +123,18 @@ IRepository GetRepository(string gitDirectory)
var branch = repository.Head;
if (branch.Tip == null)
{
throw new GitTools.WarningException("No Tip found. Has repo been initialized?");
throw new WarningException("No Tip found. Has repo been initialized?");
}
return repository;
}
catch (Exception exception)
{
if (exception.Message.Contains("LibGit2Sharp.Core.NativeMethods") || exception.Message.Contains("FilePathMarshaler"))
{
throw new GitTools.WarningException("Restart of the process may be required to load an updated version of LibGit2Sharp.");
throw new WarningException("Restart of the process may be required to load an updated version of LibGit2Sharp.");
}
throw;
}
}
}
}
}
2 changes: 1 addition & 1 deletion src/GitVersionCore/Extensions/ExtensionMethods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ public static T OnlyOrDefault<T>(this IEnumerable<T> source)
return default(T);
}
}
}
}
7 changes: 1 addition & 6 deletions src/GitVersionCore/GitPreparer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ namespace GitVersion
using System;
using System.IO;
using System.Linq;
using GitTools.Git;
using GitTools.Logging;
using LibGit2Sharp;

public class GitPreparer
Expand All @@ -31,9 +29,6 @@ public GitPreparer(string targetUrl, string dynamicRepositoryLocation, Authentic
};
this.noFetch = noFetch;
this.targetPath = targetPath.TrimEnd('/', '\\');

// GitTools has its own logging. So that it actually outputs something, it needs to be initialized.
LogProvider.SetCurrentLogProvider(new LoggerWrapper());
}

public string TargetUrl
Expand Down Expand Up @@ -266,4 +261,4 @@ static void CloneRepository(string repositoryUrl, string gitDirectory, Authentic
}
}
}
}
}
Loading

0 comments on commit 81c8c84

Please sign in to comment.