Skip to content

Commit 81c8c84

Browse files
authored
Merge pull request #1581 from arturcic/feature/Remove_GitTools.Core
Removed GitTools.Core dependency
2 parents 6baa63d + 4c8c8eb commit 81c8c84

File tree

58 files changed

+719
-275
lines changed

Some content is hidden

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

58 files changed

+719
-275
lines changed

src/Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
</PropertyGroup>
1616
<PropertyGroup>
17-
<PackageVersion_GitToolsCore>1.3.1</PackageVersion_GitToolsCore>
17+
<PackageVersion_LibGit2Sharp>0.25.0-preview-0033</PackageVersion_LibGit2Sharp>
1818
<PackageVersion_LibGit2SharpNativeBinaries>[1.0.185]</PackageVersion_LibGit2SharpNativeBinaries>
1919
<PackageVersion_JetBrainsAnnotations>2018.3.0</PackageVersion_JetBrainsAnnotations>
2020
<PackageVersion_YamlDotNet>5.3.0</PackageVersion_YamlDotNet>

src/GitVersionCore.Tests/AssemblyInfoFileUpdaterTests.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
using System;
1+
using System;
22
using System.Collections.Generic;
33
using System.IO;
4-
using System.Linq;
54
using GitVersion;
65
using GitVersion.Helpers;
76
using GitVersionCore.Tests;
@@ -482,4 +481,4 @@ private static void VerifyAssemblyInfoFile(
482481

483482
verify(fileSystem, variables);
484483
}
485-
}
484+
}

src/GitVersionCore.Tests/CommitDateTests.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
using System;
2-
using System.Collections;
3-
using System.Collections.Generic;
1+
using System;
42
using System.Linq;
53
using GitVersion;
64
using GitVersion.VersionFilters;

src/GitVersionCore.Tests/ConfigProviderTests.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
using GitTools;
21
using GitVersion;
32
using GitVersion.Helpers;
43
using GitVersionCore.Tests;

src/GitVersionCore.Tests/GitRepoMetadataProviderTests.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
namespace GitVersionCore.Tests
1+
namespace GitVersionCore.Tests
22
{
33
using System;
4-
using GitTools;
54
using GitTools.Testing;
65
using GitVersion;
76
using NUnit.Framework;
@@ -197,4 +196,4 @@ public void FindsCorrectMergeBaseForMultipleForwardMerges()
197196
}
198197
}
199198
}
200-
}
199+
}

src/GitVersionCore.Tests/GitToolsTestingExtensions.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
namespace GitVersionCore.Tests
1+
namespace GitVersionCore.Tests
22
{
33
using System;
4-
using GitTools;
54
using GitTools.Testing;
65
using GitVersion;
76
using LibGit2Sharp;
@@ -77,4 +76,4 @@ public static void InitialiseRepo(this RemoteRepositoryFixture fixture)
7776
new GitPreparer(null, null, new Authentication(), false, fixture.LocalRepositoryFixture.RepositoryPath).Initialise(true, null);
7877
}
7978
}
80-
}
79+
}

src/GitVersionCore.Tests/GitVersionCore.Tests.csproj

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
44
<TargetFramework>net461</TargetFramework>
@@ -13,7 +13,6 @@
1313
<ItemGroup>
1414
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" />
1515
<PackageReference Include="FluentDateTime" Version="1.15.0" />
16-
<PackageReference Include="GitTools.Core" Version="$(PackageVersion_GitToolsCore)" />
1716
<PackageReference Include="GitTools.Testing" Version="1.2.0" />
1817
<PackageReference Include="JetBrains.Annotations" Version="$(PackageVersion_JetBrainsAnnotations)"></PackageReference>
1918
<PackageReference Include="NSubstitute" Version="4.0.0" />

src/GitVersionCore.Tests/GitVersionInformationGeneratorTests.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
1-
using System;
2-
using System.Collections.Generic;
1+
using System;
32
using System.IO;
4-
using System.Linq;
5-
using System.Text;
6-
using System.Threading.Tasks;
73
using GitVersion;
84
using NUnit.Framework;
95
using Shouldly;

src/GitVersionCore.Tests/IntegrationTests/DocumentationSamples.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
using System;
2-
using GitTools;
1+
using System;
32
using GitTools.Testing;
3+
using GitVersion;
44
using GitVersionCore.Tests;
55
using NUnit.Framework;
66
using Shouldly;
@@ -423,4 +423,4 @@ public void GitHubFlowMajorRelease()
423423
fixture.AssertFullSemver("2.0.1+1");
424424
}
425425
}
426-
}
426+
}

src/GitVersionCore.Tests/IntegrationTests/PullRequestScenarios.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
using GitTools;
21
using GitTools.Testing;
2+
using GitVersion;
33
using GitVersionCore.Tests;
44
using LibGit2Sharp;
55
using NUnit.Framework;
@@ -109,4 +109,4 @@ public void CalculatesCorrectVersionAfterReleaseBranchMergedToMaster()
109109
fixture.AssertFullSemver("2.0.0-PullRequest0002.0");
110110
}
111111
}
112-
}
112+
}

src/GitVersionCore.Tests/IntegrationTests/RemoteRepositoryScenarios.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
using System;
2-
using GitTools.Git;
1+
using System;
32
using GitTools.Testing;
3+
using GitVersion;
44
using GitVersionCore.Tests;
55
using LibGit2Sharp;
66
using NUnit.Framework;
77
using Shouldly;
8-
using GitTools;
98

109
[TestFixture]
1110
public class RemoteRepositoryScenarios : TestBase
@@ -87,4 +86,4 @@ public void GivenARemoteGitRepositoryWhenCheckingOutDetachedhead_UsingTrackingBr
8786
fixture.AssertFullSemver("0.1.0+4", fixture.LocalRepositoryFixture.Repository);
8887
}
8988
}
90-
}
89+
}

src/GitVersionCore.Tests/VersionCalculation/NextVersionCalculatorTests.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
namespace GitVersionCore.Tests.VersionCalculation
1+
namespace GitVersionCore.Tests.VersionCalculation
22
{
33
using System;
44
using System.Collections.Generic;
5-
using GitTools;
65
using GitTools.Testing;
76
using GitVersion;
87
using GitVersion.VersionCalculation;
@@ -152,4 +151,4 @@ public void PreReleaseNumberShouldBeScopeToPreReleaseLabelInContinuousDelivery()
152151
}
153152
}
154153
}
155-
}
154+
}

src/GitVersionCore/Authentication.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ public Authentication()
1212
public string Username;
1313
public string Password;
1414
}
15-
}
15+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
namespace GitVersion
2+
{
3+
using LibGit2Sharp;
4+
5+
public class AuthenticationInfo
6+
{
7+
public string Username { get; set; }
8+
public string Password { get; set; }
9+
public string Token { get; set; }
10+
11+
public FetchOptions ToFetchOptions()
12+
{
13+
var fetchOptions = new FetchOptions();
14+
15+
if (!string.IsNullOrEmpty(Username))
16+
{
17+
fetchOptions.CredentialsProvider = (url, user, types) => new UsernamePasswordCredentials
18+
{
19+
Username = Username,
20+
Password = Password
21+
};
22+
}
23+
24+
return fetchOptions;
25+
}
26+
}
27+
}

src/GitVersionCore/Configuration/Config.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
namespace GitVersion
1+
namespace GitVersion
22
{
33
using System;
44
using System.Collections.Generic;
55
using System.Globalization;
66
using System.Linq;
7-
using System.Reflection;
87
using System.Text.RegularExpressions;
98
using YamlDotNet.Serialization;
109

@@ -145,4 +144,4 @@ T MergeObjects<T>(T target, T source)
145144
[YamlMember(Alias = "commit-date-format")]
146145
public string CommitDateFormat { get; set; }
147146
}
148-
}
147+
}

src/GitVersionCore/Configuration/ConfigurationProvider.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ namespace GitVersion
66
using System.IO;
77
using System.Linq;
88
using System.Text;
9-
using WarningException = GitTools.WarningException;
109

1110
public class ConfigurationProvider
1211
{

src/GitVersionCore/Configuration/LegacyConfig.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ namespace GitVersion
33
using System.Collections.Generic;
44
using System.Linq;
55
using YamlDotNet.Serialization;
6-
using System.Reflection;
76

87
/// <summary>
98
/// Obsolete properties are added to this, so we can check to see if they are used and provide good error messages for migration

src/GitVersionCore/Configuration/TypeHelper.cs

Lines changed: 0 additions & 30 deletions
This file was deleted.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
namespace GitVersion
2+
{
3+
using System;
4+
5+
public class BugException : Exception
6+
{
7+
public BugException(string message) : base(message)
8+
{
9+
}
10+
}
11+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
namespace GitVersion
2+
{
3+
using System;
4+
5+
[Serializable]
6+
public class GitToolsException : Exception
7+
{
8+
public GitToolsException(string messageFormat, params object[] args)
9+
: base(string.Format(messageFormat, args))
10+
{
11+
}
12+
13+
public GitToolsException(string message, Exception innerException)
14+
: base(message, innerException)
15+
{
16+
}
17+
}
18+
}

src/GitVersionCore/GitVersionException.cs renamed to src/GitVersionCore/Exceptions/GitVersionException.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
namespace GitVersion
1+
namespace GitVersion
22
{
33
using System;
44

5-
using GitTools;
6-
75
[Serializable]
86
public class GitVersionException : GitToolsException
97
{
@@ -18,4 +16,4 @@ public GitVersionException(string message, Exception innerException)
1816
{
1917
}
2018
}
21-
}
19+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
namespace GitVersion
2+
{
3+
using System;
4+
5+
[Serializable]
6+
public class WarningException : Exception
7+
{
8+
public WarningException(string message)
9+
: base(message)
10+
{
11+
}
12+
}
13+
}

src/GitVersionCore/ExecuteCore.cs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
namespace GitVersion
22
{
3-
using GitTools;
43
using GitVersion.Helpers;
54
using LibGit2Sharp;
65
using System;
7-
using System.ComponentModel;
86
using System.Linq;
9-
using System.Threading.Tasks;
107

118
public class ExecuteCore
129
{
@@ -126,18 +123,18 @@ IRepository GetRepository(string gitDirectory)
126123
var branch = repository.Head;
127124
if (branch.Tip == null)
128125
{
129-
throw new GitTools.WarningException("No Tip found. Has repo been initialized?");
126+
throw new WarningException("No Tip found. Has repo been initialized?");
130127
}
131128
return repository;
132129
}
133130
catch (Exception exception)
134131
{
135132
if (exception.Message.Contains("LibGit2Sharp.Core.NativeMethods") || exception.Message.Contains("FilePathMarshaler"))
136133
{
137-
throw new GitTools.WarningException("Restart of the process may be required to load an updated version of LibGit2Sharp.");
134+
throw new WarningException("Restart of the process may be required to load an updated version of LibGit2Sharp.");
138135
}
139136
throw;
140137
}
141138
}
142139
}
143-
}
140+
}

src/GitVersionCore/Extensions/ExtensionMethods.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,4 @@ public static T OnlyOrDefault<T>(this IEnumerable<T> source)
3939
return default(T);
4040
}
4141
}
42-
}
42+
}

src/GitVersionCore/GitPreparer.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ namespace GitVersion
33
using System;
44
using System.IO;
55
using System.Linq;
6-
using GitTools.Git;
7-
using GitTools.Logging;
86
using LibGit2Sharp;
97

108
public class GitPreparer
@@ -31,9 +29,6 @@ public GitPreparer(string targetUrl, string dynamicRepositoryLocation, Authentic
3129
};
3230
this.noFetch = noFetch;
3331
this.targetPath = targetPath.TrimEnd('/', '\\');
34-
35-
// GitTools has its own logging. So that it actually outputs something, it needs to be initialized.
36-
LogProvider.SetCurrentLogProvider(new LoggerWrapper());
3732
}
3833

3934
public string TargetUrl
@@ -266,4 +261,4 @@ static void CloneRepository(string repositoryUrl, string gitDirectory, Authentic
266261
}
267262
}
268263
}
269-
}
264+
}

0 commit comments

Comments
 (0)